diff --git a/src/Marketplace/Marketplace.Autorest/Az.Marketplace.format.ps1xml b/src/Marketplace/Marketplace.Autorest/Az.Marketplace.format.ps1xml index 2cacdbb24e52..00d7f75f3238 100644 --- a/src/Marketplace/Marketplace.Autorest/Az.Marketplace.format.ps1xml +++ b/src/Marketplace/Marketplace.Autorest/Az.Marketplace.format.ps1xml @@ -2,73 +2,21 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.MarketplaceIdentity - - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.MarketplaceIdentity - - - - - - - - - - - - - - - - - - - - - - - - AdminRequestApprovalId - - - CollectionId - - - OfferId - - - PrivateStoreId - - - RequestApprovalId - - - - - - - - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AcknowledgeOfferNotificationDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AcknowledgeOfferNotificationDetails - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AcknowledgeOfferNotificationDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AcknowledgeOfferNotificationDetails#Multiple - - - - - - @@ -76,27 +24,21 @@ Acknowledge - - AddPlan - Dismiss RemoveOffer - - RemovePlan - - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AdminRequestApprovalProperties + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalProperties - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AdminRequestApprovalProperties + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalProperties#Multiple @@ -106,18 +48,15 @@ - - - - - - + + + @@ -134,18 +73,15 @@ Administrator - - ApprovedPlan - - - CollectionId - Comment DisplayName + + Icon + OfferId @@ -158,9 +94,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AdminRequestApprovalsList + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalsList - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AdminRequestApprovalsList + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalsList#Multiple @@ -180,9 +116,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AdminRequestApprovalsResource + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalsResource - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AdminRequestApprovalsResource + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalsResource#Multiple @@ -207,6 +143,9 @@ + + + @@ -232,27 +171,30 @@ SystemDataLastModifiedByType + + ResourceGroupName + - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.BillingAccountsResponse + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AnyExistingOffersInTheCollectionsResponse - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.BillingAccountsResponse + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AnyExistingOffersInTheCollectionsResponse#Multiple - + - BillingAccount + Value @@ -260,18 +202,15 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.BulkCollectionsDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.BulkCollectionsDetails - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.BulkCollectionsDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.BulkCollectionsDetails#Multiple - - - @@ -279,18 +218,15 @@ Action - - CollectionId - - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Collection + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Collection - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Collection + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Collection#Multiple @@ -315,6 +251,9 @@ + + + @@ -340,21 +279,74 @@ SystemDataLastModifiedByType + + ResourceGroupName + - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionProperties + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByContext - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionProperties + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByContext#Multiple + + + + + + + + + + + + Context + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByContextList + + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByContextList#Multiple + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionProperties + + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionProperties#Multiple + + + + + + @@ -370,9 +362,6 @@ - - - @@ -380,6 +369,12 @@ AllSubscription + + ApproveAllItem + + + ApproveAllItemsModifiedAt + Claim @@ -395,18 +390,15 @@ NumberOfOffer - - SubscriptionsList - - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsDetails - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsDetails#Multiple @@ -432,9 +424,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsList + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsList - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsList + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsList#Multiple @@ -454,18 +446,15 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsSubscriptionsMappingDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsSubscriptionsMappingDetails - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsSubscriptionsMappingDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsSubscriptionsMappingDetails#Multiple - - - @@ -473,30 +462,27 @@ CollectionName - - Subscription - - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsToSubscriptionsMappingProperties + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ContextAndPlansDetails - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsToSubscriptionsMappingProperties + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ContextAndPlansDetails#Multiple - + - SubscriptionId + Context @@ -504,9 +490,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponseError + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponseError - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponseError + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponseError#Multiple @@ -532,9 +518,83 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.NewNotifications + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.MarketplaceIdentity + + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.MarketplaceIdentity#Multiple + + + + + + + + + + + + + + + + + + + + + + + + AdminRequestApprovalId + + + CollectionId + + + OfferId + + + PrivateStoreId + + + RequestApprovalId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.MultiContextAndPlansProperties + + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.MultiContextAndPlansProperties#Multiple + + + + + + + + + + + + + + + ETag + + + OfferId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.NewNotifications - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.NewNotifications + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.NewNotifications#Multiple @@ -578,9 +638,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.NotificationsSettingsProperties + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.NotificationsSettingsProperties - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.NotificationsSettingsProperties + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.NotificationsSettingsProperties#Multiple @@ -600,9 +660,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Offer + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Offer - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Offer + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Offer#Multiple @@ -627,6 +687,9 @@ + + + @@ -652,15 +715,18 @@ SystemDataLastModifiedByType + + ResourceGroupName + - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferListResponse + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferListResponse - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferListResponse + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferListResponse#Multiple @@ -680,9 +746,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferProperties + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferProperties - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferProperties + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferProperties#Multiple @@ -704,9 +770,6 @@ - - - @@ -735,9 +798,6 @@ PublisherDisplayName - - SpecificPlanIdsLimitation - UniqueOfferId @@ -750,9 +810,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferPropertiesIconFileUris + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferPropertiesIconFileUris - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferPropertiesIconFileUris + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferPropertiesIconFileUris#Multiple @@ -772,9 +832,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OperationListResult + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OperationListResult - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OperationListResult + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OperationListResult#Multiple @@ -794,9 +854,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Plan + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Plan - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Plan + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Plan#Multiple @@ -840,9 +900,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanDetails - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanDetails#Multiple @@ -886,9 +946,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanNotificationDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanNotificationDetails - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanNotificationDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanNotificationDetails#Multiple @@ -914,9 +974,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanRequesterDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanRequesterDetails - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanRequesterDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanRequesterDetails#Multiple @@ -942,9 +1002,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStore + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStore - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStore + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStore#Multiple @@ -969,6 +1029,9 @@ + + + @@ -994,15 +1057,18 @@ SystemDataLastModifiedByType + + ResourceGroupName + - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStoreList + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStoreList - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStoreList + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStoreList#Multiple @@ -1022,18 +1088,15 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStoreProperties + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStoreProperties - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStoreProperties + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStoreProperties#Multiple - - - @@ -1056,9 +1119,6 @@ Availability - - CollectionId - ETag @@ -1080,9 +1140,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStorePropertiesBranding + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStorePropertiesBranding - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStorePropertiesBranding + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStorePropertiesBranding#Multiple @@ -1102,18 +1162,15 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryApprovedPlans + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryApprovedPlans - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryApprovedPlans + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryApprovedPlans#Multiple - - - @@ -1121,18 +1178,15 @@ OfferId - - PlanId - - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryApprovedPlansDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryApprovedPlansDetails - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryApprovedPlansDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryApprovedPlansDetails#Multiple @@ -1142,9 +1196,6 @@ - - - @@ -1155,18 +1206,15 @@ PlanId - - SubscriptionId - - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryOffers + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryOffers - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryOffers + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryOffers#Multiple @@ -1186,9 +1234,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryRequestApproval + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryRequestApproval - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryRequestApproval + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryRequestApproval#Multiple @@ -1220,9 +1268,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Recipient + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Recipient - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Recipient + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Recipient#Multiple @@ -1254,9 +1302,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalProperties + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalProperties - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalProperties + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalProperties#Multiple @@ -1300,9 +1348,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalResource + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalResource - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalResource + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalResource#Multiple @@ -1327,6 +1375,9 @@ + + + @@ -1352,15 +1403,18 @@ SystemDataLastModifiedByType + + ResourceGroupName + - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalsDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalsDetails - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalsDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalsDetails#Multiple @@ -1404,9 +1458,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalsList + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalsList - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalsList + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalsList#Multiple @@ -1426,15 +1480,12 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestDetails - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestDetails#Multiple - - - @@ -1445,9 +1496,6 @@ - - PlanId - PublisherId @@ -1460,9 +1508,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Resource + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Resource - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Resource + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Resource#Multiple @@ -1482,9 +1530,53 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SingleOperation + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RuleListResponse + + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RuleListResponse#Multiple + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SetRulesRequest + + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SetRulesRequest#Multiple + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SingleOperation - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SingleOperation + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SingleOperation#Multiple @@ -1516,9 +1608,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SingleOperationDisplay + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SingleOperationDisplay - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SingleOperationDisplay + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SingleOperationDisplay#Multiple @@ -1556,9 +1648,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.StopSellNotifications + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.StopSellNotifications - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.StopSellNotifications + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.StopSellNotifications#Multiple @@ -1602,9 +1694,123 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SystemData + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.StopSellOffersPlansNotificationsListProperties - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SystemData + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.StopSellOffersPlansNotificationsListProperties#Multiple + + + + + + + + + + + + + + + + + + + + + + + + + + + DisplayName + + + Icon + + + IsEntire + + + MessageCode + + + OfferId + + + PublicContext + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Subscription + + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Subscription#Multiple + + + + + + + + + + + + + + + + + + DisplayName + + + State + + + SubscriptionId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SubscriptionsResponse + + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SubscriptionsResponse#Multiple + + + + + + + + + + + + + + + Count + + + SkipToken + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SystemData + + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SystemData#Multiple @@ -1654,43 +1860,31 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.TransferOffersDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.TransferOffersDetails - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.TransferOffersDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.TransferOffersDetails#Multiple - - - - - - - - OfferIdsList - Operation - - TargetCollection - - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.UserRequestDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.UserRequestDetails - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.UserRequestDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.UserRequestDetails#Multiple @@ -1734,9 +1928,9 @@ - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.WithdrawDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.WithdrawDetails - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.WithdrawDetails + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.WithdrawDetails#Multiple diff --git a/src/Marketplace/Marketplace.Autorest/Az.Marketplace.psd1 b/src/Marketplace/Marketplace.Autorest/Az.Marketplace.psd1 index 185718bce88c..e966966fa05d 100644 --- a/src/Marketplace/Marketplace.Autorest/Az.Marketplace.psd1 +++ b/src/Marketplace/Marketplace.Autorest/Az.Marketplace.psd1 @@ -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 = '' + } + } } - diff --git a/src/Marketplace/Marketplace.Autorest/Az.Marketplace.psm1 b/src/Marketplace/Marketplace.Autorest/Az.Marketplace.psm1 index 43ad62185d2b..2bc98d9b267d 100644 --- a/src/Marketplace/Marketplace.Autorest/Az.Marketplace.psm1 +++ b/src/Marketplace/Marketplace.Autorest/Az.Marketplace.psm1 @@ -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)'" @@ -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 diff --git a/src/Marketplace/Marketplace.Autorest/README.md b/src/Marketplace/Marketplace.Autorest/README.md index 7948711537da..067260867293 100644 --- a/src/Marketplace/Marketplace.Autorest/README.md +++ b/src/Marketplace/Marketplace.Autorest/README.md @@ -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. @@ -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: @@ -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 @@ -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 ``` diff --git a/src/Marketplace/Marketplace.Autorest/UX/Microsoft.Marketplace/privateStores-collections-offers.json b/src/Marketplace/Marketplace.Autorest/UX/Microsoft.Marketplace/privateStores-collections-offers.json index 49d3085a23d0..af2e1f235db6 100644 --- a/src/Marketplace/Marketplace.Autorest/UX/Microsoft.Marketplace/privateStores-collections-offers.json +++ b/src/Marketplace/Marketplace.Autorest/UX/Microsoft.Marketplace/privateStores-collections-offers.json @@ -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" }, diff --git a/src/Marketplace/Marketplace.Autorest/UX/Microsoft.Marketplace/privateStores-collections.json b/src/Marketplace/Marketplace.Autorest/UX/Microsoft.Marketplace/privateStores-collections.json index 6da4e141a8a3..9b82a2223844 100644 --- a/src/Marketplace/Marketplace.Autorest/UX/Microsoft.Marketplace/privateStores-collections.json +++ b/src/Marketplace/Marketplace.Autorest/UX/Microsoft.Marketplace/privateStores-collections.json @@ -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": [ { @@ -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 ", + "-PrivateStoreId " + ] + } + ] + }, + "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 ", + "-PrivateStoreId " + ] + } + ] + }, + "examples": [ + { + "description": "Get a list of all private store rules in the given private store and collection", "parameters": [ { "name": "-CollectionId", diff --git a/src/Marketplace/Marketplace.Autorest/UX/Microsoft.Marketplace/privateStores.json b/src/Marketplace/Marketplace.Autorest/UX/Microsoft.Marketplace/privateStores.json index e8ecea98cc3f..b19176cc12bc 100644 --- a/src/Marketplace/Marketplace.Autorest/UX/Microsoft.Marketplace/privateStores.json +++ b/src/Marketplace/Marketplace.Autorest/UX/Microsoft.Marketplace/privateStores.json @@ -1,6 +1,6 @@ { "resourceType": "privateStores", - "apiVersion": "2021-06-01", + "apiVersion": "2023-01-01", "learnMore": { "url": "https://learn.microsoft.com/powershell/module/az.marketplace" }, @@ -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": [ { @@ -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", @@ -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 " + ] + } + ] + }, + "examples": [ + { + "description": "Query whether exists any offer in the collections.", + "parameters": [ + { + "name": "-PrivateStoreId", + "value": "[Path.privateStoreId]" + } + ] + } + ] } ] } diff --git a/src/Marketplace/Marketplace.Autorest/build-module.ps1 b/src/Marketplace/Marketplace.Autorest/build-module.ps1 index 48923e1bb05d..be99a4d6d7bc 100644 --- a/src/Marketplace/Marketplace.Autorest/build-module.ps1 +++ b/src/Marketplace/Marketplace.Autorest/build-module.ps1 @@ -12,17 +12,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code # is regenerated. # ---------------------------------------------------------------------------------- -param([switch]$Isolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs) +param([switch]$NotIsolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs, [switch]$UX) $ErrorActionPreference = 'Stop' if($PSEdition -ne 'Core') { Write-Error 'This script requires PowerShell Core to execute. [Note] Generated cmdlets will work in both PowerShell Core or Windows PowerShell.' } -if(-not $Isolated -and -not $Debugger) { +if(-not $NotIsolated -and -not $Debugger) { Write-Host -ForegroundColor Green 'Creating isolated process...' $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path - & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated if($LastExitCode -ne 0) { # Build failed. Don't attempt to run the module. @@ -45,6 +45,14 @@ if(-not $Isolated -and -not $Debugger) { } } + if($UX) { + . (Join-Path $PSScriptRoot 'generate-portal-ux.ps1') + if($LastExitCode -ne 0) { + # UX generation failed. Don't attempt to run the module. + return + } + } + if($Pack) { . (Join-Path $PSScriptRoot 'pack-module.ps1') if($LastExitCode -ne 0) { @@ -123,6 +131,10 @@ $null = New-Item -ItemType Directory -Force -Path $examplesFolder Write-Host -ForegroundColor Green 'Creating cmdlets for specified models...' $modelCmdlets = @() +$modelCmdletFolder = Join-Path (Join-Path $PSScriptRoot './custom') 'autogen-model-cmdlets' +if (Test-Path $modelCmdletFolder) { + $null = Remove-Item -Force -Recurse -Path $modelCmdletFolder +} if ($modelCmdlets.Count -gt 0) { . (Join-Path $PSScriptRoot 'create-model-cmdlets.ps1') CreateModelCmdlet($modelCmdlets) @@ -139,7 +151,8 @@ if($NoDocs) { $null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue } $null = New-Item -ItemType Directory -Force -Path $docsFolder - Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid + $addComplexInterfaceInfo = ![System.Convert]::ToBoolean('true') + Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid -AddComplexInterfaceInfo:$addComplexInterfaceInfo } Write-Host -ForegroundColor Green 'Creating format.ps1xml...' @@ -158,4 +171,10 @@ Export-TestStub -ModuleName $moduleName -ExportsFolder $exportsFolder -OutputFol Write-Host -ForegroundColor Green 'Creating example stubs...' Export-ExampleStub -ExportsFolder $exportsFolder -OutputFolder $examplesFolder +if (Test-Path (Join-Path $PSScriptRoot 'generate-portal-ux.ps1')) +{ + Write-Host -ForegroundColor Green 'Creating ux metadata...' + . (Join-Path $PSScriptRoot 'generate-portal-ux.ps1') +} + Write-Host -ForegroundColor Green '-------------Done-------------' diff --git a/src/Marketplace/Marketplace.Autorest/check-dependencies.ps1 b/src/Marketplace/Marketplace.Autorest/check-dependencies.ps1 index b02ae9135957..90ca9867ae40 100644 --- a/src/Marketplace/Marketplace.Autorest/check-dependencies.ps1 +++ b/src/Marketplace/Marketplace.Autorest/check-dependencies.ps1 @@ -12,20 +12,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code # is regenerated. # ---------------------------------------------------------------------------------- -param([switch]$Isolated, [switch]$Accounts, [switch]$Pester, [switch]$Resources) +param([switch]$NotIsolated, [switch]$Accounts, [switch]$Pester, [switch]$Resources) $ErrorActionPreference = 'Stop' -if(-not $Isolated) { +if(-not $NotIsolated) { Write-Host -ForegroundColor Green 'Creating isolated process...' $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path - & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated return } function DownloadModule ([bool]$predicate, [string]$path, [string]$moduleName, [string]$versionMinimum, [string]$requiredVersion) { if($predicate) { $module = Get-Module -ListAvailable -Name $moduleName - if((-not $module) -or ($versionMinimum -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -ge [System.Version]$versionMinimum } | Measure-Object).Count -eq 0)) { + if((-not $module) -or ($versionMinimum -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -ge [System.Version]$versionMinimum } | Measure-Object).Count -eq 0) -or ($requiredVersion -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -eq [System.Version]$requiredVersion } | Measure-Object).Count -eq 0)) { $null = New-Item -ItemType Directory -Force -Path $path Write-Host -ForegroundColor Green "Installing local $moduleName module into '$path'..." if ($requiredVersion) { @@ -47,7 +47,7 @@ if(Test-Path -Path $localModulesPath) { $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" } -DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '2.2.3' +DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '2.7.5' DownloadModule -predicate ($all -or $Pester) -path $localModulesPath -moduleName 'Pester' -requiredVersion '4.10.1' $tools = Join-Path $PSScriptRoot 'tools' diff --git a/src/Marketplace/Marketplace.Autorest/create-model-cmdlets.ps1 b/src/Marketplace/Marketplace.Autorest/create-model-cmdlets.ps1 index e9d7bd7a8a0b..f6959043e89b 100644 --- a/src/Marketplace/Marketplace.Autorest/create-model-cmdlets.ps1 +++ b/src/Marketplace/Marketplace.Autorest/create-model-cmdlets.ps1 @@ -15,7 +15,7 @@ function CreateModelCmdlet { - param([string[]]$Models) + param([Hashtable[]]$Models) if ($Models.Count -eq 0) { @@ -23,10 +23,13 @@ function CreateModelCmdlet { } $ModelCsPath = Join-Path (Join-Path $PSScriptRoot 'generated\api') 'Models' - $ModuleName = 'Az.Marketplace'.Split(".")[1] $OutputDir = Join-Path $PSScriptRoot 'custom\autogen-model-cmdlets' $null = New-Item -ItemType Directory -Force -Path $OutputDir - + if (''.length -gt 0) { + $ModuleName = '' + } else { + $ModuleName = 'Az.Marketplace' + } $CsFiles = Get-ChildItem -Path $ModelCsPath -Recurse -Filter *.cs $Content = '' $null = $CsFiles | ForEach-Object -Process { if ($_.Name.Split('.').count -eq 2 ) @@ -35,15 +38,34 @@ function CreateModelCmdlet { $Tree = [Microsoft.CodeAnalysis.CSharp.SyntaxFactory]::ParseCompilationUnit($Content) $Nodes = $Tree.ChildNodes().ChildNodes() + $classConstantMember = @{} foreach ($Model in $Models) { - $InterfaceNode = $Nodes | Where-Object { ($_.Keyword.value -eq 'interface') -and ($_.Identifier.value -eq "I$Model") } + $ModelName = $Model.modelName + $InterfaceNode = $Nodes | Where-Object { ($_.Keyword.value -eq 'interface') -and ($_.Identifier.value -eq "I$ModelName") } + $ClassNode = $Nodes | Where-Object { ($_.Keyword.value -eq 'class') -and ($_.Identifier.value -eq "$ModelName") } + $classConstantMember = @() + foreach ($class in $ClassNode) { + foreach ($member in $class.Members) { + $isConstant = $false + foreach ($attr in $member.AttributeLists) { + $memberName = $attr.Attributes.Name.ToString() + if ($memberName.EndsWith('.Constant')) { + $isConstant = $true + break + } + } + if (($member.Modifiers.ToString() -eq 'public') -and $isConstant) { + $classConstantMember += $member.Identifier.Value + } + } + } if ($InterfaceNode.count -eq 0) { continue } # through a queue, we iterate all the parent models. $Queue = @($InterfaceNode) - $visited = @("I$Model") + $visited = @("I$ModelName") $AllInterfaceNodes = @() while ($Queue.count -ne 0) { @@ -61,13 +83,13 @@ function CreateModelCmdlet { } $Namespace = $InterfaceNode.Parent.Name - $ObjectType = $Model + $ObjectType = $ModelName $ObjectTypeWithNamespace = "${Namespace}.${ObjectType}" # remove duplicated module name - if ($ObjectType.StartsWith($ModuleName)) { + if ($ObjectType.StartsWith('Marketplace')) { $ModulePrefix = '' } else { - $ModulePrefix = $ModuleName + $ModulePrefix = 'Marketplace' } $OutputPath = Join-Path -ChildPath "New-Az${ModulePrefix}${ObjectType}Object.ps1" -Path $OutputDir @@ -77,10 +99,15 @@ function CreateModelCmdlet { { foreach ($Member in $Node.Members) { + if ($classConstantMember.Contains($Member.Identifier.Value)) { + # skip constant member + continue + } $Arguments = $Member.AttributeLists.Attributes.ArgumentList.Arguments $Required = $false $Description = "" $Readonly = $False + $mutability = @{Read = $true; Create = $true; Update = $true} foreach ($Argument in $Arguments) { if ($Argument.NameEquals.Name.Identifier.Value -eq "Required") @@ -95,6 +122,18 @@ function CreateModelCmdlet { { $Readonly = $Argument.Expression.Token.Value } + if ($Argument.NameEquals.Name.Identifier.Value -eq "Read") + { + $mutability.Read = $Argument.Expression.Token.Value + } + if ($Argument.NameEquals.Name.Identifier.Value -eq "Create") + { + $mutability.Create = $Argument.Expression.Token.Value + } + if ($Argument.NameEquals.Name.Identifier.Value -eq "Update") + { + $mutability.Update = $Argument.Expression.Token.Value + } } if ($Readonly) { @@ -102,8 +141,18 @@ function CreateModelCmdlet { } $Identifier = $Member.Identifier.Value $Type = $Member.Type.ToString().replace('?', '').Split("::")[-1] + $Type = $Member.Type.ToString().replace('?', '').Split("::")[-1] + if ($Type.StartsWith("System.Collections.Generic.List")) + { + # if the type is a list, we need to convert it to array + $matched = $Type -match '\<(?.+)\>$' + if ($matched) + { + $Type = $matches.Name + '[]'; + } + } $ParameterDefinePropertyList = New-Object System.Collections.Generic.List[string] - if ($Required) + if ($Required -and $mutability.Create -and $mutability.Update) { $ParameterDefinePropertyList.Add("Mandatory") } @@ -112,18 +161,31 @@ function CreateModelCmdlet { $ParameterDefinePropertyList.Add("HelpMessage=`"${Description}.`"") } $ParameterDefineProperty = [System.String]::Join(", ", $ParameterDefinePropertyList) + # check whether completer is needed + $completer = ''; + if(IsEnumType($Member)){ + $completer += GetCompleter($Member) + } $ParameterDefineScript = " - [Parameter($ParameterDefineProperty)] + [Parameter($ParameterDefineProperty)]${completer} [${Type}] `$${Identifier}" $ParameterDefineScriptList.Add($ParameterDefineScript) $ParameterAssignScriptList.Add(" - `$Object.${Identifier} = `$${Identifier}") + if (`$PSBoundParameters.ContainsKey('${Identifier}')) { + `$Object.${Identifier} = `$${Identifier} + }") } } $ParameterDefineScript = $ParameterDefineScriptList | Join-String -Separator "," $ParameterAssignScript = $ParameterAssignScriptList | Join-String -Separator "" + $cmdletName = "New-Az${ModulePrefix}${ObjectType}Object" + if ('' -ne $Model.cmdletName) { + $cmdletName = $Model.cmdletName + } + $OutputPath = Join-Path -ChildPath "${cmdletName}.ps1" -Path $OutputDir + $cmdletNameInLowerCase = $cmdletName.ToLower() $Script = " # ---------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -149,9 +211,9 @@ Create an in-memory object for ${ObjectType}. .Outputs ${ObjectTypeWithNamespace} .Link -https://learn.microsoft.com/powershell/module/az.${ModuleName}/new-Az${ModulePrefix}${ObjectType}Object +https://learn.microsoft.com/powershell/module/${ModuleName}/${cmdletNameInLowerCase} #> -function New-Az${ModulePrefix}${ObjectType}Object { +function ${cmdletName} { [OutputType('${ObjectTypeWithNamespace}')] [CmdletBinding(PositionalBinding=`$false)] Param( @@ -168,3 +230,33 @@ ${ParameterAssignScript} Set-Content -Path $OutputPath -Value $Script } } + +function IsEnumType { + param ( + [Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax]$property + ) + $isEnum = $false + foreach ($attr in $property.AttributeLists) { + $attributeName = $attr.Attributes.Name.ToString() + if ($attributeName.Contains('ArgumentCompleter')) { + $isEnum = $true + break + } + } + return $isEnum; +} + +function GetCompleter { + param ( + [Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax]$property + ) + foreach ($attr in $property.AttributeLists) { + $attributeName = $attr.Attributes.Name.ToString() + if ($attributeName.Contains('ArgumentCompleter')) { + $attributeName = $attributeName.Split("::")[-1] + $possibleValues = [System.String]::Join(", ", $attr.Attributes.ArgumentList.Arguments) + $completer += "`n [${attributeName}(${possibleValues})]" + return $completer + } + } +} diff --git a/src/Marketplace/Marketplace.Autorest/examples/Copy-AzMarketplacePrivateStoreCollectionOffer.md b/src/Marketplace/Marketplace.Autorest/examples/Copy-AzMarketplacePrivateStoreCollectionOffer.md index 1abb7250e775..f7d118410497 100644 --- a/src/Marketplace/Marketplace.Autorest/examples/Copy-AzMarketplacePrivateStoreCollectionOffer.md +++ b/src/Marketplace/Marketplace.Autorest/examples/Copy-AzMarketplacePrivateStoreCollectionOffer.md @@ -1,8 +1,10 @@ ### Example 1: Copy offers from source collection to target collections. ```powershell $payload = @{OfferIdsList = "aumatics.azure_managedservices"; Operation = "Copy"; TargetCollection = "3ac32d8c-e888-4dc6-b4ff-be4d755af13a"} - Copy-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -Payload $payload +Copy-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -Payload $payload +``` +```output Failed Succeeded ------ --------- {} {DefaultCollection} diff --git a/src/Marketplace/Marketplace.Autorest/examples/Disable-AzMarketplacePrivateStoreCollectionAllItem.md b/src/Marketplace/Marketplace.Autorest/examples/Disable-AzMarketplacePrivateStoreCollectionAllItem.md new file mode 100644 index 000000000000..2441b0212f61 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/examples/Disable-AzMarketplacePrivateStoreCollectionAllItem.md @@ -0,0 +1,6 @@ +### Example 1: Disable approve-all-items for a collection +```powershell +Disable-AzMarketplacePrivateStoreCollectionAllItem -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 +``` + +Disable approve all items for a collection. \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/examples/Enable-AzMarketplacePrivateStoreCollectionAllItem.md b/src/Marketplace/Marketplace.Autorest/examples/Enable-AzMarketplacePrivateStoreCollectionAllItem.md new file mode 100644 index 000000000000..e2f6a1aeb0fd --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/examples/Enable-AzMarketplacePrivateStoreCollectionAllItem.md @@ -0,0 +1,6 @@ +### Example 1: Enable approve-all-items for a collection +```powershell +Enable-AzMarketplacePrivateStoreCollectionAllItem -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 +``` + +Delete all existing offers from the collection and enable approve all items. \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplaceBillingPrivateStoreAccount.md b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplaceBillingPrivateStoreAccount.md index 140e8be5e1b8..a4dd928f40b0 100644 --- a/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplaceBillingPrivateStoreAccount.md +++ b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplaceBillingPrivateStoreAccount.md @@ -1,9 +1,9 @@ ### Example 1: Returns the billing account of a private store ```powershell Get-AzMarketplaceBillingPrivateStoreAccount -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a +``` - +```output - ``` This command returns the billing account of a private store. \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplaceCollectionToSubscriptionMapping.md b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplaceCollectionToSubscriptionMapping.md index 07fdec7fafb8..2f5612438f38 100644 --- a/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplaceCollectionToSubscriptionMapping.md +++ b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplaceCollectionToSubscriptionMapping.md @@ -1,11 +1,12 @@ -### Example 1: For a given subscriptions list, the Cmdlet will return a map of collections and the related subscriptions from the supplied list. +### Example 1: Map subscriptions to collections ```powershell - $res = Get-AzMarketplaceCollectionToSubscriptionMapping -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -Payload @{SubscriptionId = "53425a7b-4ac1-4729-8340-e1da5046212c"} +$res = Get-AzMarketplaceCollectionToSubscriptionMapping -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -Payload @{SubscriptionId = "53425a7b-4ac1-4729-8340-e1da5046212c"} $res.keys +``` + +```output e58535dc-1be3-4d2c-904c-1f97984ebe5d fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 ``` -This command For a given subscriptions list, will return a map of collections and the related subscriptions from the supplied list. - - +This command For a given subscriptions list, will return a map of collections and the related subscriptions from the supplied list. \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.md b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.md new file mode 100644 index 000000000000..0374f5c75d6e --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.md @@ -0,0 +1,6 @@ +### Example 1: Fetch all subscriptions in a tenant +```powershell +Get-AzMarketplacePrivateStoreAllSubscriptionInTenant -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 +``` + +Fetch all subscriptions in tenant, only for marketplace admin. \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreCollection.md b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreCollection.md index d509dadb2616..0354b0b7b787 100644 --- a/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreCollection.md +++ b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreCollection.md @@ -1,7 +1,9 @@ ### Example 1: Get list of private store collections ```powershell Get-AzMarketplacePrivateStoreCollection -PrivateStoreId 53425a7b-4ac1-4729-8340-e1da5046212c +``` +```output Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ---- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- 53425a7b-4ac1-4729-8340-e1da5046212c User 8/23/2021 6:06:52 AM User @@ -9,7 +11,7 @@ Name SystemDataCreatedAt SystemDataCreatedBy Sy ``` -This command gets list of private store collections +This command gets list of private store collections. diff --git a/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.md b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.md new file mode 100644 index 000000000000..91690533430f --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.md @@ -0,0 +1,6 @@ +### Example 1: Map offers to subscriptions +```powershell +Get-AzMarketplacePrivateStoreCollectionMapOffersToContext -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionId 1f58b5dd-313c-42ed-84fc-f1e351bba7fb,ab3de7bc-7a6e-4e9f-a34a-f6922df453e4 +``` + +Get a list of all offers in the given collection according to the required subscriptions. \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreCollectionOffer.md b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreCollectionOffer.md index c4c4079ec601..b55974d2ff55 100644 --- a/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreCollectionOffer.md +++ b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreCollectionOffer.md @@ -1,7 +1,9 @@ -### Example 1: Gets collection offers. +### Example 1: Gets collection offers ```powershell Get-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 +``` +```output Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ---- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ------------------- data3-limited-1019419.d3_azure_managed_services @@ -9,4 +11,4 @@ viacode_consulting-1089577.viacodems RedHat.RHEL_7 ``` -This command get colletion offer \ No newline at end of file +This command get collection offers. \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreCollectionRule.md b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreCollectionRule.md new file mode 100644 index 000000000000..a51a7cdb2ed1 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreCollectionRule.md @@ -0,0 +1,6 @@ +### Example 1: Get applied rules on a collection +```powershell +Get-AzMarketplacePrivateStoreCollectionRule -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 +``` + +Get a list of all private store rules in the given private store and collection. \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreNewPlanNotification.md b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreNewPlanNotification.md new file mode 100644 index 000000000000..911f7f61d40c --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreNewPlanNotification.md @@ -0,0 +1,6 @@ +### Example 1: List new plans notifications +```powershell +Get-AzMarketplacePrivateStoreNewPlanNotification -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 +``` + +List new plans notifications. \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreSubscription.md b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreSubscription.md new file mode 100644 index 000000000000..51191bd23561 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreSubscription.md @@ -0,0 +1,6 @@ +### Example 1: List all subscriptions +```powershell +Get-AzMarketplacePrivateStoreSubscription -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 +``` + +List all subscriptions in the private store context. \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreUserOffer.md b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreUserOffer.md new file mode 100644 index 000000000000..d4790d5bea7e --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreUserOffer.md @@ -0,0 +1,6 @@ +### Example 1: List all approved offers for a user +```powershell +Get-AzMarketplacePrivateStoreUserOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -OfferId aumatics.azure_managedservices -SubscriptionId 1f58b5dd-313c-42ed-84fc-f1e351bba7fb +``` + +List of user's approved offers for the provided offers and subscriptions. \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreUserRule.md b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreUserRule.md new file mode 100644 index 000000000000..e280b0c6a149 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreUserRule.md @@ -0,0 +1,6 @@ +### Example 1: Get all applied rules for user subscriptions +```powershell +Get-AzMarketplacePrivateStoreUserRule -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionId 1f58b5dd-313c-42ed-84fc-f1e351bba7fb +``` + +All rules approved in the private store that are relevant for user subscriptions. \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreV1.md b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreV1.md index fa275b34a16d..4f012e683374 100644 --- a/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreV1.md +++ b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplacePrivateStoreV1.md @@ -1,13 +1,12 @@ ### Example 1: Get Private Store details ```powershell Get-AzMarketplacePrivateStoreV1 +``` +```output Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ---- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- a260d38c-96cf-492d-a340-404d0c4b3ad6 User 12/1/2021 9:01:33 PM User ``` -This command Gets the private store details - - - +This command Gets the private store details \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplaceQueryPrivateStoreOffer.md b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplaceQueryPrivateStoreOffer.md index 386e7ebd208a..12b7461599b9 100644 --- a/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplaceQueryPrivateStoreOffer.md +++ b/src/Marketplace/Marketplace.Autorest/examples/Get-AzMarketplaceQueryPrivateStoreOffer.md @@ -1,7 +1,9 @@ ### Example 1: Returns private store offer regardless of collections ```powershell Get-AzMarketplaceQueryPrivateStoreOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a +``` +```output CreatedAt ETag ModifiedAt OfferDisplayName PrivateStoreId PublisherDisplayName SpecificPlanIdLimitation UniqueOfferId --------- ---- ---------- ---------------- -------------- -------------------- ------------------------- ------------- "ed0093ae-0000-0100-0000-61a4dab30000" 3ac32d8c-e888-4dc6-b4ff-be4d755af13a {d3-azure-health-check, data3-azure-optimiser-plan, data3-managed-azure-plan} data3-limite… diff --git a/src/Marketplace/Marketplace.Autorest/examples/New-AzMarketplacePrivateStore.md b/src/Marketplace/Marketplace.Autorest/examples/New-AzMarketplacePrivateStore.md index ae575cce9f72..de6f10f817a2 100644 --- a/src/Marketplace/Marketplace.Autorest/examples/New-AzMarketplacePrivateStore.md +++ b/src/Marketplace/Marketplace.Autorest/examples/New-AzMarketplacePrivateStore.md @@ -1,8 +1,6 @@ ### Example 1: Changes private store properties ```powershell New-AzMarketplacePrivateStore -Id 0000000-0000-00000-0000-000000000000 -Availability 'disabled' -ETag '0000000-0000-00000-0000-000000000000' - - ``` This command changes private store properties. diff --git a/src/Marketplace/Marketplace.Autorest/examples/New-AzMarketplacePrivateStoreCollection.md b/src/Marketplace/Marketplace.Autorest/examples/New-AzMarketplacePrivateStoreCollection.md index 5622edcd5253..b9f36b40fd36 100644 --- a/src/Marketplace/Marketplace.Autorest/examples/New-AzMarketplacePrivateStoreCollection.md +++ b/src/Marketplace/Marketplace.Autorest/examples/New-AzMarketplacePrivateStoreCollection.md @@ -1,7 +1,9 @@ ### Example 1: Create or updates private store collection ```powershell New-AzMarketplacePrivateStoreCollection -CollectionName test -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -SubscriptionsList 7f5402e4-e8f4-46bd-9bd1-8d27866a606b +``` +```output Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ---- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 12/13/2021 11:12:27 AM User 12/13/2021 11:12:27 AM User diff --git a/src/Marketplace/Marketplace.Autorest/examples/New-AzMarketplacePrivateStoreCollectionOffer.md b/src/Marketplace/Marketplace.Autorest/examples/New-AzMarketplacePrivateStoreCollectionOffer.md index 1cfd5f3cd9ea..c9cc43ffadc1 100644 --- a/src/Marketplace/Marketplace.Autorest/examples/New-AzMarketplacePrivateStoreCollectionOffer.md +++ b/src/Marketplace/Marketplace.Autorest/examples/New-AzMarketplacePrivateStoreCollectionOffer.md @@ -2,7 +2,9 @@ ```powershell $acc = @{Accessibility = "azure_managedservices_professional"} New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -OfferId aumatics.azure_managedservices -Plan $acc +``` +```output Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ---- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- aumatics.azure_managedservices diff --git a/src/Marketplace/Marketplace.Autorest/examples/New-AzMarketplacePrivateStoreCollectionOfferMultiContext.md b/src/Marketplace/Marketplace.Autorest/examples/New-AzMarketplacePrivateStoreCollectionOfferMultiContext.md new file mode 100644 index 000000000000..3cab4409acf0 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/examples/New-AzMarketplacePrivateStoreCollectionOfferMultiContext.md @@ -0,0 +1,18 @@ +### Example 1: Upsert an offer with multiple contexts +```powershell +$plan1 = @{ + context = "1f58b5dd-313c-42ed-84fc-f1e351bba7fb" + planId = "plan1" +} + +$plan2 = @{ + context = "ab3de7bc-7a6e-4e9f-a34a-f6922df453e4" + planId = "plan2" +} + +$plans = @($plan1,$plan2) + +New-AzMarketplacePrivateStoreCollectionOfferMultiContext -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -OfferId test_pmc2pc1.vm_4plans -PlansContext $plans +``` + +Upsert an offer with multiple context details. \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/examples/Remove-AzMarketplacePrivateStoreCollection.md b/src/Marketplace/Marketplace.Autorest/examples/Remove-AzMarketplacePrivateStoreCollection.md index 38cb5f882502..cd0f1ca067cf 100644 --- a/src/Marketplace/Marketplace.Autorest/examples/Remove-AzMarketplacePrivateStoreCollection.md +++ b/src/Marketplace/Marketplace.Autorest/examples/Remove-AzMarketplacePrivateStoreCollection.md @@ -1,7 +1,6 @@ ### Example 1: Removes private store collection ```powershell Remove-AzMarketplacePrivateStoreCollection -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 - ``` This command removes private store collection diff --git a/src/Marketplace/Marketplace.Autorest/examples/Remove-AzMarketplacePrivateStoreCollectionOffer.md b/src/Marketplace/Marketplace.Autorest/examples/Remove-AzMarketplacePrivateStoreCollectionOffer.md index 9c8192ec6a7d..1160c857122d 100644 --- a/src/Marketplace/Marketplace.Autorest/examples/Remove-AzMarketplacePrivateStoreCollectionOffer.md +++ b/src/Marketplace/Marketplace.Autorest/examples/Remove-AzMarketplacePrivateStoreCollectionOffer.md @@ -1,6 +1,6 @@ ### Example 1: Removes offer from private store collection ```powershell - Remove-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -OfferId aumatics.azure_managedservices +Remove-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -OfferId aumatics.azure_managedservices ``` This command removes offer from private store collection diff --git a/src/Marketplace/Marketplace.Autorest/examples/Set-AzMarketplaceBulkPrivateStoreCollectionAction.md b/src/Marketplace/Marketplace.Autorest/examples/Set-AzMarketplaceBulkPrivateStoreCollectionAction.md index ed91bf2e7e5b..f4f8d45759a9 100644 --- a/src/Marketplace/Marketplace.Autorest/examples/Set-AzMarketplaceBulkPrivateStoreCollectionAction.md +++ b/src/Marketplace/Marketplace.Autorest/examples/Set-AzMarketplaceBulkPrivateStoreCollectionAction.md @@ -1,7 +1,9 @@ ### Example 1: Preforms bulk action on collections ```powershell Set-AzMarketplaceBulkPrivateStoreCollectionAction -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -Payload @{Action = "EnableCollections"; CollectionId = "3ac32d8c-e888-4dc6-b4ff-be4d755af13a", "fdb889a1-cf3e-49f0-95b8-2bb012fa01f1" } +``` +```output Failed Succeeded ------ --------- {} {DefaultCollection, test} diff --git a/src/Marketplace/Marketplace.Autorest/examples/Set-AzMarketplacePrivateStore.md b/src/Marketplace/Marketplace.Autorest/examples/Set-AzMarketplacePrivateStore.md index 01a207bf3fc3..3fa779be67bf 100644 --- a/src/Marketplace/Marketplace.Autorest/examples/Set-AzMarketplacePrivateStore.md +++ b/src/Marketplace/Marketplace.Autorest/examples/Set-AzMarketplacePrivateStore.md @@ -1,8 +1,6 @@ ### Example 1: Changes private store properties ```powershell Set-AzMarketplacePrivateStore -Id 0000000-0000-00000-0000-000000000000 -Availability 'disabled' -ETag '0000000-0000-00000-0000-000000000000' - - ``` This command changes private store properties diff --git a/src/Marketplace/Marketplace.Autorest/examples/Set-AzMarketplacePrivateStoreCollection.md b/src/Marketplace/Marketplace.Autorest/examples/Set-AzMarketplacePrivateStoreCollection.md index 2824d025c48a..b008bbca848c 100644 --- a/src/Marketplace/Marketplace.Autorest/examples/Set-AzMarketplacePrivateStoreCollection.md +++ b/src/Marketplace/Marketplace.Autorest/examples/Set-AzMarketplacePrivateStoreCollection.md @@ -1,7 +1,9 @@ ### Example 1: Creates or updates private store collection ```powershell Set-AzMarketplacePrivateStoreCollection -CollectionId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -AllSubscription +``` +```output Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ---- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- 7f5402e4-e8f4-46bd-9bd1-8d27866a606b User 12/13/2021 1:21:57 PM User diff --git a/src/Marketplace/Marketplace.Autorest/examples/Set-AzMarketplacePrivateStoreCollectionOffer.md b/src/Marketplace/Marketplace.Autorest/examples/Set-AzMarketplacePrivateStoreCollectionOffer.md index 1cfd5f3cd9ea..c9cc43ffadc1 100644 --- a/src/Marketplace/Marketplace.Autorest/examples/Set-AzMarketplacePrivateStoreCollectionOffer.md +++ b/src/Marketplace/Marketplace.Autorest/examples/Set-AzMarketplacePrivateStoreCollectionOffer.md @@ -2,7 +2,9 @@ ```powershell $acc = @{Accessibility = "azure_managedservices_professional"} New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -OfferId aumatics.azure_managedservices -Plan $acc +``` +```output Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ---- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- aumatics.azure_managedservices diff --git a/src/Marketplace/Marketplace.Autorest/examples/Test-AzMarketplacePrivateStoreAnyExistingOffer.md b/src/Marketplace/Marketplace.Autorest/examples/Test-AzMarketplacePrivateStoreAnyExistingOffer.md new file mode 100644 index 000000000000..fe544e625e9a --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/examples/Test-AzMarketplacePrivateStoreAnyExistingOffer.md @@ -0,0 +1,6 @@ +### Example 1: Check if exists any offer in the collections. +```powershell +Test-AzMarketplacePrivateStoreAnyExistingOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 +``` + +Query whether exists any offer in the collections. \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/examples/Update-AzMarketplacePrivateStoreCollection.md b/src/Marketplace/Marketplace.Autorest/examples/Update-AzMarketplacePrivateStoreCollection.md new file mode 100644 index 000000000000..ad0972a3e465 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/examples/Update-AzMarketplacePrivateStoreCollection.md @@ -0,0 +1,6 @@ +### Example 1: Update private store collection +```powershell +Update-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId 8c7a91db-cd41-43b6-af47-2e869654126d -Enabled +``` + +Update private store collection. \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/examples/Update-AzMarketplacePrivateStoreCollectionOffer.md b/src/Marketplace/Marketplace.Autorest/examples/Update-AzMarketplacePrivateStoreCollectionOffer.md new file mode 100644 index 000000000000..b935c2a4aebf --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/examples/Update-AzMarketplacePrivateStoreCollectionOffer.md @@ -0,0 +1,6 @@ +### Example 1: Update private store collection offer +```powershell +Update-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId 8c7a91db-cd41-43b6-af47-2e869654126d -OfferId "aumatics.azure_managedservices" -SpecificPlanIdLimitation $null +``` + +Update private store collection offer. \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/export-surface.ps1 b/src/Marketplace/Marketplace.Autorest/export-surface.ps1 index 31aee74c55df..7a09ce2c4da6 100644 --- a/src/Marketplace/Marketplace.Autorest/export-surface.ps1 +++ b/src/Marketplace/Marketplace.Autorest/export-surface.ps1 @@ -12,13 +12,13 @@ # Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code # is regenerated. # ---------------------------------------------------------------------------------- -param([switch]$Isolated, [switch]$IncludeGeneralParameters, [switch]$UseExpandedFormat) +param([switch]$NotIsolated, [switch]$IncludeGeneralParameters, [switch]$UseExpandedFormat) $ErrorActionPreference = 'Stop' $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path -if(-not $Isolated) { +if(-not $NotIsolated) { Write-Host -ForegroundColor Green 'Creating isolated process...' - & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated return } diff --git a/src/Marketplace/Marketplace.Autorest/exports/Copy-AzMarketplacePrivateStoreCollectionOffer.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Copy-AzMarketplacePrivateStoreCollectionOffer.ps1 index 0930f47fc36f..6cbc89a15ef1 100644 --- a/src/Marketplace/Marketplace.Autorest/exports/Copy-AzMarketplacePrivateStoreCollectionOffer.ps1 +++ b/src/Marketplace/Marketplace.Autorest/exports/Copy-AzMarketplacePrivateStoreCollectionOffer.ps1 @@ -20,19 +20,15 @@ transferring offers (copy or move) from source collection to target collection(s .Description transferring offers (copy or move) from source collection to target collection(s) .Example -PS C:\> $payload = @{OfferIdsList = "aumatics.azure_managedservices"; Operation = "Copy"; TargetCollection = "3ac32d8c-e888-4dc6-b4ff-be4d755af13a"} -PS C:\> Copy-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -Payload $payload +$payload = @{OfferIdsList = "aumatics.azure_managedservices"; Operation = "Copy"; TargetCollection = "3ac32d8c-e888-4dc6-b4ff-be4d755af13a"} +Copy-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -Payload $payload -Failed Succeeded ------- --------- -{} {DefaultCollection} - -.Inputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse .Notes COMPLEX PARAMETER PROPERTIES @@ -47,18 +43,30 @@ INPUTOBJECT : Identity Parameter [RequestApprovalId ]: The request approval ID to get create or update PAYLOAD : Transfer offers properties - [OfferIdsList ]: Offers ids list to transfer from source collection to target collection(s) + [OfferIdsList >]: Offers ids list to transfer from source collection to target collection(s) [Operation ]: Operation to perform (For example: Copy or Move) - [TargetCollection ]: Target collections ids + [TargetCollection >]: Target collections ids + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update .Link https://learn.microsoft.com/powershell/module/az.marketplace/copy-azmarketplaceprivatestorecollectionoffer #> function Copy-AzMarketplacePrivateStoreCollectionOffer { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse])] [CmdletBinding(DefaultParameterSetName='TransferExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Transfer', Mandatory)] [Parameter(ParameterSetName='TransferExpanded', Mandatory)] + [Parameter(ParameterSetName='TransferViaIdentityPrivateStore', Mandatory)] + [Parameter(ParameterSetName='TransferViaIdentityPrivateStoreExpanded', Mandatory)] + [Parameter(ParameterSetName='TransferViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='TransferViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The collection ID @@ -66,6 +74,8 @@ param( [Parameter(ParameterSetName='Transfer', Mandatory)] [Parameter(ParameterSetName='TransferExpanded', Mandatory)] + [Parameter(ParameterSetName='TransferViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='TransferViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The store ID - must use the tenant ID @@ -79,16 +89,26 @@ param( # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, + [Parameter(ParameterSetName='TransferViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TransferViaIdentityPrivateStoreExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + [Parameter(ParameterSetName='Transfer', Mandatory, ValueFromPipeline)] [Parameter(ParameterSetName='TransferViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TransferViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties] # Transfer offers properties # To construct, see NOTES section for PAYLOAD properties and create a hash table. ${Payload}, [Parameter(ParameterSetName='TransferExpanded')] [Parameter(ParameterSetName='TransferViaIdentityExpanded')] + [Parameter(ParameterSetName='TransferViaIdentityPrivateStoreExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String[]] @@ -97,6 +117,7 @@ param( [Parameter(ParameterSetName='TransferExpanded')] [Parameter(ParameterSetName='TransferViaIdentityExpanded')] + [Parameter(ParameterSetName='TransferViaIdentityPrivateStoreExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String] # Operation to perform (For example: Copy or Move) @@ -104,18 +125,32 @@ param( [Parameter(ParameterSetName='TransferExpanded')] [Parameter(ParameterSetName='TransferViaIdentityExpanded')] + [Parameter(ParameterSetName='TransferViaIdentityPrivateStoreExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String[]] # Target collections ids ${TargetCollection}, + [Parameter(ParameterSetName='TransferViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Path of Json file supplied to the Transfer operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='TransferViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Json string supplied to the Transfer operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -165,19 +200,46 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ Transfer = 'Az.Marketplace.private\Copy-AzMarketplacePrivateStoreCollectionOffer_Transfer'; TransferExpanded = 'Az.Marketplace.private\Copy-AzMarketplacePrivateStoreCollectionOffer_TransferExpanded'; TransferViaIdentity = 'Az.Marketplace.private\Copy-AzMarketplacePrivateStoreCollectionOffer_TransferViaIdentity'; TransferViaIdentityExpanded = 'Az.Marketplace.private\Copy-AzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityExpanded'; + TransferViaIdentityPrivateStore = 'Az.Marketplace.private\Copy-AzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityPrivateStore'; + TransferViaIdentityPrivateStoreExpanded = 'Az.Marketplace.private\Copy-AzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityPrivateStoreExpanded'; + TransferViaJsonFilePath = 'Az.Marketplace.private\Copy-AzMarketplacePrivateStoreCollectionOffer_TransferViaJsonFilePath'; + TransferViaJsonString = 'Az.Marketplace.private\Copy-AzMarketplacePrivateStoreCollectionOffer_TransferViaJsonString'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -186,15 +248,32 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/exports/Disable-AzMarketplacePrivateStoreCollectionAllItem.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Disable-AzMarketplacePrivateStoreCollectionAllItem.ps1 new file mode 100644 index 000000000000..53d7c74d7983 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/exports/Disable-AzMarketplacePrivateStoreCollectionAllItem.ps1 @@ -0,0 +1,210 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Disable approve all items for the collection. +.Description +Disable approve all items for the collection. +.Example +Disable-AzMarketplacePrivateStoreCollectionAllItem -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/disable-azmarketplaceprivatestorecollectionallitem +#> +function Disable-AzMarketplacePrivateStoreCollectionAllItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection])] +[CmdletBinding(DefaultParameterSetName='Disable', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Disable', Mandatory)] + [Parameter(ParameterSetName='DisableViaIdentityPrivateStore', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The collection ID + ${CollectionId}, + + [Parameter(ParameterSetName='Disable', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='DisableViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='DisableViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Disable = 'Az.Marketplace.private\Disable-AzMarketplacePrivateStoreCollectionAllItem_Disable'; + DisableViaIdentity = 'Az.Marketplace.private\Disable-AzMarketplacePrivateStoreCollectionAllItem_DisableViaIdentity'; + DisableViaIdentityPrivateStore = 'Az.Marketplace.private\Disable-AzMarketplacePrivateStoreCollectionAllItem_DisableViaIdentityPrivateStore'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Marketplace/Marketplace.Autorest/exports/Enable-AzMarketplacePrivateStoreCollectionAllItem.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Enable-AzMarketplacePrivateStoreCollectionAllItem.ps1 new file mode 100644 index 000000000000..0b28eee7609a --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/exports/Enable-AzMarketplacePrivateStoreCollectionAllItem.ps1 @@ -0,0 +1,210 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Delete all existing offers from the collection and enable approve all items. +.Description +Delete all existing offers from the collection and enable approve all items. +.Example +Enable-AzMarketplacePrivateStoreCollectionAllItem -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/enable-azmarketplaceprivatestorecollectionallitem +#> +function Enable-AzMarketplacePrivateStoreCollectionAllItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection])] +[CmdletBinding(DefaultParameterSetName='Approve', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Approve', Mandatory)] + [Parameter(ParameterSetName='ApproveViaIdentityPrivateStore', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The collection ID + ${CollectionId}, + + [Parameter(ParameterSetName='Approve', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='ApproveViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='ApproveViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Approve = 'Az.Marketplace.private\Enable-AzMarketplacePrivateStoreCollectionAllItem_Approve'; + ApproveViaIdentity = 'Az.Marketplace.private\Enable-AzMarketplacePrivateStoreCollectionAllItem_ApproveViaIdentity'; + ApproveViaIdentityPrivateStore = 'Az.Marketplace.private\Enable-AzMarketplacePrivateStoreCollectionAllItem_ApproveViaIdentityPrivateStore'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplaceBillingPrivateStoreAccount.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplaceBillingPrivateStoreAccount.ps1 index f0270d058e84..38c102788168 100644 --- a/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplaceBillingPrivateStoreAccount.ps1 +++ b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplaceBillingPrivateStoreAccount.ps1 @@ -20,16 +20,12 @@ Tenant billing accounts names .Description Tenant billing accounts names .Example -PS C:\> Get-AzMarketplaceBillingPrivateStoreAccount -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a - - - - +Get-AzMarketplaceBillingPrivateStoreAccount -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -System.String +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse .Notes COMPLEX PARAMETER PROPERTIES @@ -46,7 +42,7 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplacebillingprivatestoreaccount #> function Get-AzMarketplaceBillingPrivateStoreAccount { -[OutputType([System.String])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse])] [CmdletBinding(DefaultParameterSetName='Billing', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Billing', Mandatory)] @@ -67,7 +63,8 @@ param( [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -117,17 +114,40 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ Billing = 'Az.Marketplace.private\Get-AzMarketplaceBillingPrivateStoreAccount_Billing'; BillingViaIdentity = 'Az.Marketplace.private\Get-AzMarketplaceBillingPrivateStoreAccount_BillingViaIdentity'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -136,15 +156,32 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplaceCollectionToSubscriptionMapping.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplaceCollectionToSubscriptionMapping.ps1 index 44eb7328540b..7df1ed833ee7 100644 --- a/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplaceCollectionToSubscriptionMapping.ps1 +++ b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplaceCollectionToSubscriptionMapping.ps1 @@ -20,17 +20,15 @@ For a given subscriptions list, the API will return a map of collections and the .Description For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied list. .Example -PS C:\> $res = Get-AzMarketplaceCollectionToSubscriptionMapping -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -Payload @{SubscriptionId = "53425a7b-4ac1-4729-8340-e1da5046212c"} -PS C:\> $res.keys -e58535dc-1be3-4d2c-904c-1f97984ebe5d -fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 +$res = Get-AzMarketplaceCollectionToSubscriptionMapping -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -Payload @{SubscriptionId = "53425a7b-4ac1-4729-8340-e1da5046212c"} +$res.keys .Inputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse .Notes COMPLEX PARAMETER PROPERTIES @@ -45,16 +43,18 @@ INPUTOBJECT : Identity Parameter [RequestApprovalId ]: The request approval ID to get create or update PAYLOAD : The subscriptions list to get the related collections - [SubscriptionId ]: Subscriptions ids list + [SubscriptionId >]: Subscriptions ids list .Link https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplacecollectiontosubscriptionmapping #> function Get-AzMarketplaceCollectionToSubscriptionMapping { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse])] [CmdletBinding(DefaultParameterSetName='CollectionsExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Collections', Mandatory)] [Parameter(ParameterSetName='CollectionsExpanded', Mandatory)] + [Parameter(ParameterSetName='CollectionsViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CollectionsViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The store ID - must use the tenant ID @@ -71,7 +71,7 @@ param( [Parameter(ParameterSetName='Collections', Mandatory, ValueFromPipeline)] [Parameter(ParameterSetName='CollectionsViaIdentity', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload] # The subscriptions list to get the related collections # To construct, see NOTES section for PAYLOAD properties and create a hash table. ${Payload}, @@ -85,12 +85,25 @@ param( # Subscriptions ids list ${SubscriptionId}, + [Parameter(ParameterSetName='CollectionsViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Path of Json file supplied to the Collections operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CollectionsViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Json string supplied to the Collections operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -140,22 +153,47 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ Collections = 'Az.Marketplace.private\Get-AzMarketplaceCollectionToSubscriptionMapping_Collections'; CollectionsExpanded = 'Az.Marketplace.private\Get-AzMarketplaceCollectionToSubscriptionMapping_CollectionsExpanded'; CollectionsViaIdentity = 'Az.Marketplace.private\Get-AzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentity'; CollectionsViaIdentityExpanded = 'Az.Marketplace.private\Get-AzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentityExpanded'; + CollectionsViaJsonFilePath = 'Az.Marketplace.private\Get-AzMarketplaceCollectionToSubscriptionMapping_CollectionsViaJsonFilePath'; + CollectionsViaJsonString = 'Az.Marketplace.private\Get-AzMarketplaceCollectionToSubscriptionMapping_CollectionsViaJsonString'; } - if (('CollectionsExpanded', 'CollectionsViaIdentityExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + if (('CollectionsExpanded', 'CollectionsViaIdentityExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -164,15 +202,32 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.ps1 new file mode 100644 index 000000000000..01b90d4e634e --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.ps1 @@ -0,0 +1,193 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Fetch all subscriptions in tenant, only for marketplace admin +.Description +Fetch all subscriptions in tenant, only for marketplace admin +.Example +Get-AzMarketplacePrivateStoreAllSubscriptionInTenant -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreallsubscriptionintenant +#> +function Get-AzMarketplacePrivateStoreAllSubscriptionInTenant { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse])] +[CmdletBinding(DefaultParameterSetName='Fetch', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Fetch', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='FetchViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Header')] + [System.String] + # The skip token to get the next page. + ${NextPageToken}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Fetch = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreAllSubscriptionInTenant_Fetch'; + FetchViaIdentity = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreAllSubscriptionInTenant_FetchViaIdentity'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreCollection.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreCollection.ps1 index 0c55ea97d588..89d75c995c70 100644 --- a/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreCollection.ps1 +++ b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreCollection.ps1 @@ -20,20 +20,14 @@ Gets private store collection .Description Gets private store collection .Example -PS C:\> Get-AzMarketplacePrivateStoreCollection -PrivateStoreId 53425a7b-4ac1-4729-8340-e1da5046212c - -Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ----- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- -53425a7b-4ac1-4729-8340-e1da5046212c User 8/23/2021 6:06:52 AM User -23455a7b-4ac1-4729-8340-e1da5046212c 12/1/2021 9:01:33 PM User 12/1/2021 9:01:33 PM User - +Get-AzMarketplacePrivateStoreCollection -PrivateStoreId 53425a7b-4ac1-4729-8340-e1da5046212c .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsList +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsList .Notes COMPLEX PARAMETER PROPERTIES @@ -46,14 +40,23 @@ INPUTOBJECT : Identity Parameter [OfferId ]: The offer ID to update or delete [PrivateStoreId ]: The store ID - must use the tenant ID [RequestApprovalId ]: The request approval ID to get create or update + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update .Link https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollection #> function Get-AzMarketplacePrivateStoreCollection { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection], [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsList])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection], [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsList])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='GetViaIdentityPrivateStore', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The collection ID @@ -73,12 +76,20 @@ param( # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, + [Parameter(ParameterSetName='GetViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -128,18 +139,42 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ Get = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollection_Get'; GetViaIdentity = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollection_GetViaIdentity'; + GetViaIdentityPrivateStore = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollection_GetViaIdentityPrivateStore'; List = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollection_List'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -148,15 +183,32 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.ps1 new file mode 100644 index 000000000000..c2c7c2a5996a --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.ps1 @@ -0,0 +1,182 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Get a list of all offers in the given collection according to the required contexts. +.Description +Get a list of all offers in the given collection according to the required contexts. +.Example +Get-AzMarketplacePrivateStoreCollectionMapOffersToContext -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionId 1f58b5dd-313c-42ed-84fc-f1e351bba7fb,ab3de7bc-7a6e-4e9f-a34a-f6922df453e4 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContext +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollectionmapofferstocontext +#> +function Get-AzMarketplacePrivateStoreCollectionMapOffersToContext { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContext])] +[CmdletBinding(DefaultParameterSetName='ListExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The collection ID + ${CollectionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Subscription ids list + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + ListExpanded = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionMapOffersToContext_ListExpanded'; + } + if (('ListExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreCollectionOffer.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreCollectionOffer.ps1 index 0e330a077de3..12acf5f71e63 100644 --- a/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreCollectionOffer.ps1 +++ b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreCollectionOffer.ps1 @@ -20,23 +20,25 @@ Gets information about a specific offer. .Description Gets information about a specific offer. .Example -PS C:\> Get-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 - -Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ----- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ------------------- -data3-limited-1019419.d3_azure_managed_services -viacode_consulting-1089577.viacodems -RedHat.RHEL_7 +Get-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. +COLLECTIONINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + INPUTOBJECT : Identity Parameter [AdminRequestApprovalId ]: The admin request approval ID to get create or update [CollectionId ]: The collection ID @@ -44,14 +46,23 @@ INPUTOBJECT : Identity Parameter [OfferId ]: The offer ID to update or delete [PrivateStoreId ]: The store ID - must use the tenant ID [RequestApprovalId ]: The request approval ID to get create or update + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update .Link https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollectionoffer #> function Get-AzMarketplacePrivateStoreCollectionOffer { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='GetViaIdentityPrivateStore', Mandatory)] [Parameter(ParameterSetName='List', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] @@ -59,6 +70,8 @@ param( ${CollectionId}, [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='GetViaIdentityCollection', Mandatory)] + [Parameter(ParameterSetName='GetViaIdentityPrivateStore', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The offer ID to update or delete @@ -78,12 +91,27 @@ param( # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, + [Parameter(ParameterSetName='GetViaIdentityCollection', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + ${CollectionInputObject}, + + [Parameter(ParameterSetName='GetViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -133,18 +161,43 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ Get = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionOffer_Get'; GetViaIdentity = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionOffer_GetViaIdentity'; + GetViaIdentityCollection = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionOffer_GetViaIdentityCollection'; + GetViaIdentityPrivateStore = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionOffer_GetViaIdentityPrivateStore'; List = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionOffer_List'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -153,15 +206,32 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreCollectionRule.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreCollectionRule.ps1 new file mode 100644 index 000000000000..ebca57f3726f --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreCollectionRule.ps1 @@ -0,0 +1,210 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Get a list of all private store rules in the given private store and collection +.Description +Get a list of all private store rules in the given private store and collection +.Example +Get-AzMarketplacePrivateStoreCollectionRule -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollectionrule +#> +function Get-AzMarketplacePrivateStoreCollectionRule { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse])] +[CmdletBinding(DefaultParameterSetName='Query', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Query', Mandatory)] + [Parameter(ParameterSetName='QueryViaIdentityPrivateStore', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The collection ID + ${CollectionId}, + + [Parameter(ParameterSetName='Query', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='QueryViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='QueryViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Query = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionRule_Query'; + QueryViaIdentity = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionRule_QueryViaIdentity'; + QueryViaIdentityPrivateStore = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionRule_QueryViaIdentityPrivateStore'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreNewPlanNotification.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreNewPlanNotification.ps1 new file mode 100644 index 000000000000..4a2db83431aa --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreNewPlanNotification.ps1 @@ -0,0 +1,165 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +List new plans notifications +.Description +List new plans notifications +.Example +Get-AzMarketplacePrivateStoreNewPlanNotification -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsList +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorenewplannotification +#> +function Get-AzMarketplacePrivateStoreNewPlanNotification { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsList])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreNewPlanNotification_List'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreSubscription.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreSubscription.ps1 new file mode 100644 index 000000000000..463787248442 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreSubscription.ps1 @@ -0,0 +1,165 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +List all the subscriptions in the private store context +.Description +List all the subscriptions in the private store context +.Example +Get-AzMarketplacePrivateStoreSubscription -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextList +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoresubscription +#> +function Get-AzMarketplacePrivateStoreSubscription { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextList])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + List = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreSubscription_List'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreUserOffer.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreUserOffer.ps1 new file mode 100644 index 000000000000..06d3df71d71c --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreUserOffer.ps1 @@ -0,0 +1,205 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +List of user's approved offers for the provided offers and subscriptions +.Description +List of user's approved offers for the provided offers and subscriptions +.Example +Get-AzMarketplacePrivateStoreUserOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -OfferId aumatics.azure_managedservices -SubscriptionId 1f58b5dd-313c-42ed-84fc-f1e351bba7fb + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreuseroffer +#> +function Get-AzMarketplacePrivateStoreUserOffer { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers])] +[CmdletBinding(DefaultParameterSetName='QueryExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='QueryExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='QueryViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String[]] + # List of offer IDs + ${OfferId}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # List of subscription IDs + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + QueryExpanded = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreUserOffer_QueryExpanded'; + QueryViaIdentityExpanded = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreUserOffer_QueryViaIdentityExpanded'; + } + if (('QueryExpanded', 'QueryViaIdentityExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreUserRule.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreUserRule.ps1 new file mode 100644 index 000000000000..528d89b212b3 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreUserRule.ps1 @@ -0,0 +1,198 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +All rules approved in the private store that are relevant for user subscriptions +.Description +All rules approved in the private store that are relevant for user subscriptions +.Example +Get-AzMarketplacePrivateStoreUserRule -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionId 1f58b5dd-313c-42ed-84fc-f1e351bba7fb + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreuserrule +#> +function Get-AzMarketplacePrivateStoreUserRule { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse])] +[CmdletBinding(DefaultParameterSetName='QueryExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='QueryExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='QueryViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # List of subscription IDs + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + QueryExpanded = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreUserRule_QueryExpanded'; + QueryViaIdentityExpanded = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreUserRule_QueryViaIdentityExpanded'; + } + if (('QueryExpanded', 'QueryViaIdentityExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreV1.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreV1.ps1 index ac9abb09c246..e3f1d2409617 100644 --- a/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreV1.ps1 +++ b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplacePrivateStoreV1.ps1 @@ -20,16 +20,12 @@ Get information about the private store .Description Get information about the private store .Example -PS C:\> Get-AzMarketplacePrivateStoreV1 - -Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ----- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- -a260d38c-96cf-492d-a340-404d0c4b3ad6 User 12/1/2021 9:01:33 PM User +Get-AzMarketplacePrivateStoreV1 .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore .Notes COMPLEX PARAMETER PROPERTIES @@ -46,7 +42,7 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorev1 #> function Get-AzMarketplacePrivateStoreV1 { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter(ParameterSetName='Get', Mandatory)] @@ -74,7 +70,8 @@ param( [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -124,6 +121,24 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ Get = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreV1_Get'; GetViaIdentity = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreV1_GetViaIdentity'; @@ -131,11 +146,16 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -144,15 +164,32 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplaceQueryPrivateStoreOffer.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplaceQueryPrivateStoreOffer.ps1 index 1e329ee9e120..9deca0258a24 100644 --- a/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplaceQueryPrivateStoreOffer.ps1 +++ b/src/Marketplace/Marketplace.Autorest/exports/Get-AzMarketplaceQueryPrivateStoreOffer.ps1 @@ -20,21 +20,12 @@ List of offers, regardless the collections .Description List of offers, regardless the collections .Example -PS C:\> Get-AzMarketplaceQueryPrivateStoreOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a - -CreatedAt ETag ModifiedAt OfferDisplayName PrivateStoreId PublisherDisplayName SpecificPlanIdLimitation UniqueOfferId ---------- ---- ---------- ---------------- -------------- -------------------- ------------------------- ------------- - "ed0093ae-0000-0100-0000-61a4dab30000" 3ac32d8c-e888-4dc6-b4ff-be4d755af13a {d3-azure-health-check, data3-azure-optimiser-plan, data3-managed-azure-plan} data3-limite… - "750547d8-0000-0100-0000-61b752010000" 3ac32d8c-e888-4dc6-b4ff-be4d755af13a {mgmt-limited-free, mgmt-assessment} viacode_cons… - "ef00ab05-0000-0100-0000-61a5f12f0000" 3ac32d8c-e888-4dc6-b4ff-be4d755af13a {RedHatEnterpriseLinux72-ARM} RedHat.RHEL_7 - "f300276b-0000-0100-0000-61a7e1af0000" 3ac32d8c-e888-4dc6-b4ff-be4d755af13a {128technology_conductor_hourly_427, 128technology_conductor_hourly_452} 128technolog… - "f300296b-0000-0100-0000-61a7e1af0000" 3ac32d8c-e888-4dc6-b4ff-be4d755af13a {128technology_router_100_hourly_427, 128technology_router_100_hourly_452} 128technolog… - +Get-AzMarketplaceQueryPrivateStoreOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffers +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers .Notes COMPLEX PARAMETER PROPERTIES @@ -51,7 +42,7 @@ INPUTOBJECT : Identity Parameter https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplacequeryprivatestoreoffer #> function Get-AzMarketplaceQueryPrivateStoreOffer { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffers])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers])] [CmdletBinding(DefaultParameterSetName='Query', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Query', Mandatory)] @@ -72,7 +63,8 @@ param( [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -122,17 +114,40 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ Query = 'Az.Marketplace.private\Get-AzMarketplaceQueryPrivateStoreOffer_Query'; QueryViaIdentity = 'Az.Marketplace.private\Get-AzMarketplaceQueryPrivateStoreOffer_QueryViaIdentity'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -141,15 +156,32 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/exports/New-AzMarketplacePrivateStore.ps1 b/src/Marketplace/Marketplace.Autorest/exports/New-AzMarketplacePrivateStore.ps1 index 4fbec59704b5..31f954ba8184 100644 --- a/src/Marketplace/Marketplace.Autorest/exports/New-AzMarketplacePrivateStore.ps1 +++ b/src/Marketplace/Marketplace.Autorest/exports/New-AzMarketplacePrivateStore.ps1 @@ -20,9 +20,7 @@ Changes private store properties .Description Changes private store properties .Example -PS C:\> New-AzMarketplacePrivateStore -Id 0000000-0000-00000-0000-000000000000 -Availability 'disabled' -ETag '0000000-0000-00000-0000-000000000000' - - +New-AzMarketplacePrivateStore -Id 0000000-0000-00000-0000-000000000000 -Availability 'disabled' -ETag '0000000-0000-00000-0000-000000000000' .Outputs System.Boolean @@ -47,64 +45,77 @@ param( # The store ID - must use the tenant ID ${Id}, - [Parameter()] - [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability])] + [Parameter(ParameterSetName='CreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("enabled", "disabled")] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability] + [System.String] # Indicates private store availability ${Availability}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding]))] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding]))] [System.Collections.Hashtable] # Gets or sets list of branding characteristics ${Branding}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String] # Identifier for purposes of race condition ${ETag}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.Management.Automation.SwitchParameter] # Is government ${IsGov}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[]] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient[]] # Gets or sets list of notified recipients for new requests # To construct, see NOTES section for NOTIFICATIONSETTINGRECIPIENT properties and create a hash table. ${NotificationSettingRecipient}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.Management.Automation.SwitchParameter] # Gets or sets whether to send email to all marketplace admins for new requests ${NotificationSettingSendToAllMarketplaceAdmin}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String] # Private Store Name ${PrivateStoreName}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String] # Tenant id ${TenantId}, + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -160,16 +171,41 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ CreateExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStore_CreateExpanded'; + CreateViaJsonFilePath = 'Az.Marketplace.private\New-AzMarketplacePrivateStore_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.Marketplace.private\New-AzMarketplacePrivateStore_CreateViaJsonString'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -178,15 +214,32 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/exports/New-AzMarketplacePrivateStoreCollection.ps1 b/src/Marketplace/Marketplace.Autorest/exports/New-AzMarketplacePrivateStoreCollection.ps1 index 325ffcb6cf1d..86b43106a404 100644 --- a/src/Marketplace/Marketplace.Autorest/exports/New-AzMarketplacePrivateStoreCollection.ps1 +++ b/src/Marketplace/Marketplace.Autorest/exports/New-AzMarketplacePrivateStoreCollection.ps1 @@ -16,23 +16,42 @@ <# .Synopsis -Create or update private store collection +Create private store collection .Description -Create or update private store collection +Create private store collection .Example -PS C:\> New-AzMarketplacePrivateStoreCollection -CollectionName test -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -SubscriptionsList 7f5402e4-e8f4-46bd-9bd1-8d27866a606b - -Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ----- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- -fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 12/13/2021 11:12:27 AM User 12/13/2021 11:12:27 AM User +New-AzMarketplacePrivateStoreCollection -CollectionName test -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -SubscriptionsList 7f5402e4-e8f4-46bd-9bd1-8d27866a606b +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +PAYLOAD : The Collection data structure. + [AllSubscription ]: Indicating whether all subscriptions are selected (=true) or not (=false). + [Claim ]: Gets or sets the association with Commercial's Billing Account. + [CollectionName ]: Gets or sets collection name. + [Enabled ]: Indicating whether the collection is enabled or disabled. + [SubscriptionsList >]: Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update .Link https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollection #> function New-AzMarketplacePrivateStoreCollection { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection])] [CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -41,37 +60,52 @@ param( # The collection ID ${CollectionId}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The store ID - must use the tenant ID ${PrivateStoreId}, - [Parameter()] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.Management.Automation.SwitchParameter] # Indicating whether all subscriptions are selected (=true) or not (=false). ${AllSubscription}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String] # Gets or sets the association with Commercial's Billing Account. ${Claim}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String] # Gets or sets collection name. ${CollectionName}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.Management.Automation.SwitchParameter] # Indicating whether the collection is enabled or disabled. ${Enabled}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String[]] @@ -80,12 +114,32 @@ param( # On insert, null is considered as bad request ${SubscriptionsList}, + [Parameter(ParameterSetName='CreateViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection] + # The Collection data structure. + # To construct, see NOTES section for PAYLOAD properties and create a hash table. + ${Payload}, + + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -135,16 +189,43 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ CreateExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollection_CreateExpanded'; + CreateViaIdentityPrivateStore = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollection_CreateViaIdentityPrivateStore'; + CreateViaIdentityPrivateStoreExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollection_CreateViaIdentityPrivateStoreExpanded'; + CreateViaJsonFilePath = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollection_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollection_CreateViaJsonString'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -153,15 +234,32 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/exports/New-AzMarketplacePrivateStoreCollectionOffer.ps1 b/src/Marketplace/Marketplace.Autorest/exports/New-AzMarketplacePrivateStoreCollectionOffer.ps1 index 2b3a4a38d49b..8918b765ebf1 100644 --- a/src/Marketplace/Marketplace.Autorest/exports/New-AzMarketplacePrivateStoreCollectionOffer.ps1 +++ b/src/Marketplace/Marketplace.Autorest/exports/New-AzMarketplacePrivateStoreCollectionOffer.ps1 @@ -20,88 +20,166 @@ Update or add an offer to a specific collection of the private store. .Description Update or add an offer to a specific collection of the private store. .Example -PS C:\>$acc = @{Accessibility = "azure_managedservices_professional"} -PS C:\> New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -OfferId aumatics.azure_managedservices -Plan $acc - -Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ----- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- -aumatics.azure_managedservices +$acc = @{Accessibility = "azure_managedservices_professional"} +New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -OfferId aumatics.azure_managedservices -Plan $acc +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. +COLLECTIONINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +PAYLOAD : The privateStore offer data structure. + [ETag ]: Identifier for purposes of race condition + [IconFileUri ]: Icon File Uris + [(Any) ]: This indicates any property can be added to this object. + [Plan >]: Offer plans + [Accessibility ]: Plan accessibility + [SpecificPlanIdsLimitation >]: Plan ids limitation for this offer + [UpdateSuppressedDueIdempotence ]: Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated. + PLAN : Offer plans - [Accessibility ]: Plan accessibility + [Accessibility ]: Plan accessibility + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update .Link https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollectionoffer #> function New-AzMarketplacePrivateStoreCollectionOffer { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer])] [CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] - # The collection ID - ${CollectionId}, + # The offer ID to update or delete + ${OfferId}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStore', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] - # The offer ID to update or delete - ${OfferId}, + # The collection ID + ${CollectionId}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The store ID - must use the tenant ID ${PrivateStoreId}, - [Parameter()] + [Parameter(ParameterSetName='CreateViaIdentityCollection', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentityCollectionExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + ${CollectionInputObject}, + + [Parameter(ParameterSetName='CreateViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String] # Identifier for purposes of race condition ${ETag}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris]))] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris]))] [System.Collections.Hashtable] # Icon File Uris ${IconFileUri}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan[]] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[]] # Offer plans # To construct, see NOTES section for PLAN properties and create a hash table. ${Plan}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String[]] # Plan ids limitation for this offer ${SpecificPlanIdLimitation}, - [Parameter()] + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.Management.Automation.SwitchParameter] # Indicating whether the offer was not updated to db (true = not updated). # If the allow list is identical to the existed one in db, the offer would not be updated. ${UpdateSuppressedDueIdempotence}, + [Parameter(ParameterSetName='CreateViaIdentityCollection', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer] + # The privateStore offer data structure. + # To construct, see NOTES section for PAYLOAD properties and create a hash table. + ${Payload}, + + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -151,16 +229,45 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ CreateExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOffer_CreateExpanded'; + CreateViaIdentityCollection = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityCollection'; + CreateViaIdentityCollectionExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityCollectionExpanded'; + CreateViaIdentityPrivateStore = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityPrivateStore'; + CreateViaIdentityPrivateStoreExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityPrivateStoreExpanded'; + CreateViaJsonFilePath = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOffer_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOffer_CreateViaJsonString'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -169,15 +276,32 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/exports/New-AzMarketplacePrivateStoreCollectionOfferMultiContext.ps1 b/src/Marketplace/Marketplace.Autorest/exports/New-AzMarketplacePrivateStoreCollectionOfferMultiContext.ps1 new file mode 100644 index 000000000000..ab8d0c387eef --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/exports/New-AzMarketplacePrivateStoreCollectionOfferMultiContext.ps1 @@ -0,0 +1,270 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Upsert an offer with multiple context details. +.Description +Upsert an offer with multiple context details. +.Example +$plan1 = @{ + context = "1f58b5dd-313c-42ed-84fc-f1e351bba7fb" + planId = "plan1" +} + +$plan2 = @{ + context = "ab3de7bc-7a6e-4e9f-a34a-f6922df453e4" + planId = "plan2" +} + +$plans = @($plan1,$plan2) + +New-AzMarketplacePrivateStoreCollectionOfferMultiContext -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -OfferId test_pmc2pc1.vm_4plans -PlansContext $plans + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +COLLECTIONINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +PLANSCONTEXT : . + [Context ]: Plan's context, e.g. subscription ID, tenant ID. + [PlanId >]: List of plan IDs. + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollectionoffermulticontext +#> +function New-AzMarketplacePrivateStoreCollectionOfferMultiContext { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer])] +[CmdletBinding(DefaultParameterSetName='OfferExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The offer ID to update or delete + ${OfferId}, + + [Parameter(ParameterSetName='OfferExpanded', Mandatory)] + [Parameter(ParameterSetName='OfferViaIdentityPrivateStoreExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The collection ID + ${CollectionId}, + + [Parameter(ParameterSetName='OfferExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='OfferViaIdentityCollectionExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + ${CollectionInputObject}, + + [Parameter(ParameterSetName='OfferViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='OfferViaIdentityPrivateStoreExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # The offer's eTag. + ${ETag}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails[]] + # . + # To construct, see NOTES section for PLANSCONTEXT properties and create a hash table. + ${PlansContext}, + + [Parameter(ParameterSetName='OfferExpanded')] + [Parameter(ParameterSetName='OfferViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='OfferViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # The offer ID which contains the plans. + ${PropertiesOfferId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + OfferExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOfferMultiContext_OfferExpanded'; + OfferViaIdentityCollectionExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityCollectionExpanded'; + OfferViaIdentityExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityExpanded'; + OfferViaIdentityPrivateStoreExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityPrivateStoreExpanded'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Marketplace/Marketplace.Autorest/exports/ProxyCmdletDefinitions.ps1 b/src/Marketplace/Marketplace.Autorest/exports/ProxyCmdletDefinitions.ps1 index 3b48af35a81e..6f1e64973b7e 100644 --- a/src/Marketplace/Marketplace.Autorest/exports/ProxyCmdletDefinitions.ps1 +++ b/src/Marketplace/Marketplace.Autorest/exports/ProxyCmdletDefinitions.ps1 @@ -20,19 +20,15 @@ transferring offers (copy or move) from source collection to target collection(s .Description transferring offers (copy or move) from source collection to target collection(s) .Example -PS C:\> $payload = @{OfferIdsList = "aumatics.azure_managedservices"; Operation = "Copy"; TargetCollection = "3ac32d8c-e888-4dc6-b4ff-be4d755af13a"} -PS C:\> Copy-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -Payload $payload +$payload = @{OfferIdsList = "aumatics.azure_managedservices"; Operation = "Copy"; TargetCollection = "3ac32d8c-e888-4dc6-b4ff-be4d755af13a"} +Copy-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -Payload $payload -Failed Succeeded ------- --------- -{} {DefaultCollection} - -.Inputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse .Notes COMPLEX PARAMETER PROPERTIES @@ -47,18 +43,30 @@ INPUTOBJECT : Identity Parameter [RequestApprovalId ]: The request approval ID to get create or update PAYLOAD : Transfer offers properties - [OfferIdsList ]: Offers ids list to transfer from source collection to target collection(s) + [OfferIdsList >]: Offers ids list to transfer from source collection to target collection(s) [Operation ]: Operation to perform (For example: Copy or Move) - [TargetCollection ]: Target collections ids + [TargetCollection >]: Target collections ids + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update .Link https://learn.microsoft.com/powershell/module/az.marketplace/copy-azmarketplaceprivatestorecollectionoffer #> function Copy-AzMarketplacePrivateStoreCollectionOffer { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse])] [CmdletBinding(DefaultParameterSetName='TransferExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Transfer', Mandatory)] [Parameter(ParameterSetName='TransferExpanded', Mandatory)] + [Parameter(ParameterSetName='TransferViaIdentityPrivateStore', Mandatory)] + [Parameter(ParameterSetName='TransferViaIdentityPrivateStoreExpanded', Mandatory)] + [Parameter(ParameterSetName='TransferViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='TransferViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The collection ID @@ -66,6 +74,8 @@ param( [Parameter(ParameterSetName='Transfer', Mandatory)] [Parameter(ParameterSetName='TransferExpanded', Mandatory)] + [Parameter(ParameterSetName='TransferViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='TransferViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The store ID - must use the tenant ID @@ -79,16 +89,26 @@ param( # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, + [Parameter(ParameterSetName='TransferViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TransferViaIdentityPrivateStoreExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + [Parameter(ParameterSetName='Transfer', Mandatory, ValueFromPipeline)] [Parameter(ParameterSetName='TransferViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='TransferViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties] # Transfer offers properties # To construct, see NOTES section for PAYLOAD properties and create a hash table. ${Payload}, [Parameter(ParameterSetName='TransferExpanded')] [Parameter(ParameterSetName='TransferViaIdentityExpanded')] + [Parameter(ParameterSetName='TransferViaIdentityPrivateStoreExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String[]] @@ -97,6 +117,7 @@ param( [Parameter(ParameterSetName='TransferExpanded')] [Parameter(ParameterSetName='TransferViaIdentityExpanded')] + [Parameter(ParameterSetName='TransferViaIdentityPrivateStoreExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String] # Operation to perform (For example: Copy or Move) @@ -104,18 +125,32 @@ param( [Parameter(ParameterSetName='TransferExpanded')] [Parameter(ParameterSetName='TransferViaIdentityExpanded')] + [Parameter(ParameterSetName='TransferViaIdentityPrivateStoreExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String[]] # Target collections ids ${TargetCollection}, + [Parameter(ParameterSetName='TransferViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Path of Json file supplied to the Transfer operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='TransferViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Json string supplied to the Transfer operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -165,19 +200,46 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ Transfer = 'Az.Marketplace.private\Copy-AzMarketplacePrivateStoreCollectionOffer_Transfer'; TransferExpanded = 'Az.Marketplace.private\Copy-AzMarketplacePrivateStoreCollectionOffer_TransferExpanded'; TransferViaIdentity = 'Az.Marketplace.private\Copy-AzMarketplacePrivateStoreCollectionOffer_TransferViaIdentity'; TransferViaIdentityExpanded = 'Az.Marketplace.private\Copy-AzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityExpanded'; + TransferViaIdentityPrivateStore = 'Az.Marketplace.private\Copy-AzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityPrivateStore'; + TransferViaIdentityPrivateStoreExpanded = 'Az.Marketplace.private\Copy-AzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityPrivateStoreExpanded'; + TransferViaJsonFilePath = 'Az.Marketplace.private\Copy-AzMarketplacePrivateStoreCollectionOffer_TransferViaJsonFilePath'; + TransferViaJsonString = 'Az.Marketplace.private\Copy-AzMarketplacePrivateStoreCollectionOffer_TransferViaJsonString'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -186,35 +248,48 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } <# .Synopsis -Tenant billing accounts names +Disable approve all items for the collection. .Description -Tenant billing accounts names +Disable approve all items for the collection. .Example -PS C:\> Get-AzMarketplaceBillingPrivateStoreAccount -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a - - - - +Disable-AzMarketplacePrivateStoreCollectionAllItem -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -System.String +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection .Notes COMPLEX PARAMETER PROPERTIES @@ -227,32 +302,55 @@ INPUTOBJECT : Identity Parameter [OfferId ]: The offer ID to update or delete [PrivateStoreId ]: The store ID - must use the tenant ID [RequestApprovalId ]: The request approval ID to get create or update + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update .Link -https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplacebillingprivatestoreaccount +https://learn.microsoft.com/powershell/module/az.marketplace/disable-azmarketplaceprivatestorecollectionallitem #> -function Get-AzMarketplaceBillingPrivateStoreAccount { -[OutputType([System.String])] -[CmdletBinding(DefaultParameterSetName='Billing', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Disable-AzMarketplacePrivateStoreCollectionAllItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection])] +[CmdletBinding(DefaultParameterSetName='Disable', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(ParameterSetName='Billing', Mandatory)] + [Parameter(ParameterSetName='Disable', Mandatory)] + [Parameter(ParameterSetName='DisableViaIdentityPrivateStore', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The collection ID + ${CollectionId}, + + [Parameter(ParameterSetName='Disable', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The store ID - must use the tenant ID ${PrivateStoreId}, - [Parameter(ParameterSetName='BillingViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='DisableViaIdentity', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] # Identity Parameter # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, + [Parameter(ParameterSetName='DisableViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -302,17 +400,41 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ - Billing = 'Az.Marketplace.private\Get-AzMarketplaceBillingPrivateStoreAccount_Billing'; - BillingViaIdentity = 'Az.Marketplace.private\Get-AzMarketplaceBillingPrivateStoreAccount_BillingViaIdentity'; + Disable = 'Az.Marketplace.private\Disable-AzMarketplacePrivateStoreCollectionAllItem_Disable'; + DisableViaIdentity = 'Az.Marketplace.private\Disable-AzMarketplacePrivateStoreCollectionAllItem_DisableViaIdentity'; + DisableViaIdentityPrivateStore = 'Az.Marketplace.private\Disable-AzMarketplacePrivateStoreCollectionAllItem_DisableViaIdentityPrivateStore'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -321,36 +443,48 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } <# .Synopsis -For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied list. +Delete all existing offers from the collection and enable approve all items. .Description -For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied list. +Delete all existing offers from the collection and enable approve all items. .Example -PS C:\> $res = Get-AzMarketplaceCollectionToSubscriptionMapping -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -Payload @{SubscriptionId = "53425a7b-4ac1-4729-8340-e1da5046212c"} -PS C:\> $res.keys -e58535dc-1be3-4d2c-904c-1f97984ebe5d -fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 +Enable-AzMarketplacePrivateStoreCollectionAllItem -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 -.Inputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection .Notes COMPLEX PARAMETER PROPERTIES @@ -364,53 +498,54 @@ INPUTOBJECT : Identity Parameter [PrivateStoreId ]: The store ID - must use the tenant ID [RequestApprovalId ]: The request approval ID to get create or update -PAYLOAD : The subscriptions list to get the related collections - [SubscriptionId ]: Subscriptions ids list +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update .Link -https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplacecollectiontosubscriptionmapping +https://learn.microsoft.com/powershell/module/az.marketplace/enable-azmarketplaceprivatestorecollectionallitem #> -function Get-AzMarketplaceCollectionToSubscriptionMapping { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties])] -[CmdletBinding(DefaultParameterSetName='CollectionsExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Enable-AzMarketplacePrivateStoreCollectionAllItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection])] +[CmdletBinding(DefaultParameterSetName='Approve', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(ParameterSetName='Collections', Mandatory)] - [Parameter(ParameterSetName='CollectionsExpanded', Mandatory)] + [Parameter(ParameterSetName='Approve', Mandatory)] + [Parameter(ParameterSetName='ApproveViaIdentityPrivateStore', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The collection ID + ${CollectionId}, + + [Parameter(ParameterSetName='Approve', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The store ID - must use the tenant ID ${PrivateStoreId}, - [Parameter(ParameterSetName='CollectionsViaIdentity', Mandatory, ValueFromPipeline)] - [Parameter(ParameterSetName='CollectionsViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='ApproveViaIdentity', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] # Identity Parameter # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, - [Parameter(ParameterSetName='Collections', Mandatory, ValueFromPipeline)] - [Parameter(ParameterSetName='CollectionsViaIdentity', Mandatory, ValueFromPipeline)] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload] - # The subscriptions list to get the related collections - # To construct, see NOTES section for PAYLOAD properties and create a hash table. - ${Payload}, - - [Parameter(ParameterSetName='CollectionsExpanded')] - [Parameter(ParameterSetName='CollectionsViaIdentityExpanded')] - [AllowEmptyCollection()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] - [System.String[]] - # Subscriptions ids list - ${SubscriptionId}, + [Parameter(ParameterSetName='ApproveViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -460,22 +595,41 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName - $mapping = @{ - Collections = 'Az.Marketplace.private\Get-AzMarketplaceCollectionToSubscriptionMapping_Collections'; - CollectionsExpanded = 'Az.Marketplace.private\Get-AzMarketplaceCollectionToSubscriptionMapping_CollectionsExpanded'; - CollectionsViaIdentity = 'Az.Marketplace.private\Get-AzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentity'; - CollectionsViaIdentityExpanded = 'Az.Marketplace.private\Get-AzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentityExpanded'; + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' } - if (('CollectionsExpanded', 'CollectionsViaIdentityExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + + $mapping = @{ + Approve = 'Az.Marketplace.private\Enable-AzMarketplacePrivateStoreCollectionAllItem_Approve'; + ApproveViaIdentity = 'Az.Marketplace.private\Enable-AzMarketplacePrivateStoreCollectionAllItem_ApproveViaIdentity'; + ApproveViaIdentityPrivateStore = 'Az.Marketplace.private\Enable-AzMarketplacePrivateStoreCollectionAllItem_ApproveViaIdentityPrivateStore'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -484,37 +638,48 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } <# .Synopsis -Gets information about a specific offer. +Tenant billing accounts names .Description -Gets information about a specific offer. +Tenant billing accounts names .Example -PS C:\> Get-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 - -Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ----- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ------------------- -data3-limited-1019419.d3_azure_managed_services -viacode_consulting-1089577.viacodems -RedHat.RHEL_7 +Get-AzMarketplaceBillingPrivateStoreAccount -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse .Notes COMPLEX PARAMETER PROPERTIES @@ -528,33 +693,19 @@ INPUTOBJECT : Identity Parameter [PrivateStoreId ]: The store ID - must use the tenant ID [RequestApprovalId ]: The request approval ID to get create or update .Link -https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollectionoffer +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplacebillingprivatestoreaccount #> -function Get-AzMarketplacePrivateStoreCollectionOffer { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer])] -[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +function Get-AzMarketplaceBillingPrivateStoreAccount { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse])] +[CmdletBinding(DefaultParameterSetName='Billing', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(ParameterSetName='Get', Mandatory)] - [Parameter(ParameterSetName='List', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] - [System.String] - # The collection ID - ${CollectionId}, - - [Parameter(ParameterSetName='Get', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] - [System.String] - # The offer ID to update or delete - ${OfferId}, - - [Parameter(ParameterSetName='Get', Mandatory)] - [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='Billing', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The store ID - must use the tenant ID ${PrivateStoreId}, - [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='BillingViaIdentity', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] # Identity Parameter @@ -566,7 +717,8 @@ param( [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -616,18 +768,40 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ - Get = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionOffer_Get'; - GetViaIdentity = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionOffer_GetViaIdentity'; - List = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionOffer_List'; + Billing = 'Az.Marketplace.private\Get-AzMarketplaceBillingPrivateStoreAccount_Billing'; + BillingViaIdentity = 'Az.Marketplace.private\Get-AzMarketplaceBillingPrivateStoreAccount_BillingViaIdentity'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -636,39 +810,51 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } <# .Synopsis -Gets private store collection +For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied list. .Description -Gets private store collection +For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied list. .Example -PS C:\> Get-AzMarketplacePrivateStoreCollection -PrivateStoreId 53425a7b-4ac1-4729-8340-e1da5046212c - -Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ----- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- -53425a7b-4ac1-4729-8340-e1da5046212c User 8/23/2021 6:06:52 AM User -23455a7b-4ac1-4729-8340-e1da5046212c 12/1/2021 9:01:33 PM User 12/1/2021 9:01:33 PM User - +$res = Get-AzMarketplaceCollectionToSubscriptionMapping -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -Payload @{SubscriptionId = "53425a7b-4ac1-4729-8340-e1da5046212c"} +$res.keys +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection -.Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsList +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse .Notes COMPLEX PARAMETER PROPERTIES @@ -681,39 +867,69 @@ INPUTOBJECT : Identity Parameter [OfferId ]: The offer ID to update or delete [PrivateStoreId ]: The store ID - must use the tenant ID [RequestApprovalId ]: The request approval ID to get create or update + +PAYLOAD : The subscriptions list to get the related collections + [SubscriptionId >]: Subscriptions ids list .Link -https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollection +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplacecollectiontosubscriptionmapping #> -function Get-AzMarketplacePrivateStoreCollection { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection], [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsList])] -[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +function Get-AzMarketplaceCollectionToSubscriptionMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse])] +[CmdletBinding(DefaultParameterSetName='CollectionsExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(ParameterSetName='Get', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] - [System.String] - # The collection ID - ${CollectionId}, - - [Parameter(ParameterSetName='Get', Mandatory)] - [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='Collections', Mandatory)] + [Parameter(ParameterSetName='CollectionsExpanded', Mandatory)] + [Parameter(ParameterSetName='CollectionsViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CollectionsViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The store ID - must use the tenant ID ${PrivateStoreId}, - [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CollectionsViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CollectionsViaIdentityExpanded', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] # Identity Parameter # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, + [Parameter(ParameterSetName='Collections', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CollectionsViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload] + # The subscriptions list to get the related collections + # To construct, see NOTES section for PAYLOAD properties and create a hash table. + ${Payload}, + + [Parameter(ParameterSetName='CollectionsExpanded')] + [Parameter(ParameterSetName='CollectionsViaIdentityExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Subscriptions ids list + ${SubscriptionId}, + + [Parameter(ParameterSetName='CollectionsViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Path of Json file supplied to the Collections operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CollectionsViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Json string supplied to the Collections operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -763,18 +979,47 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ - Get = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollection_Get'; - GetViaIdentity = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollection_GetViaIdentity'; - List = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollection_List'; + Collections = 'Az.Marketplace.private\Get-AzMarketplaceCollectionToSubscriptionMapping_Collections'; + CollectionsExpanded = 'Az.Marketplace.private\Get-AzMarketplaceCollectionToSubscriptionMapping_CollectionsExpanded'; + CollectionsViaIdentity = 'Az.Marketplace.private\Get-AzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentity'; + CollectionsViaIdentityExpanded = 'Az.Marketplace.private\Get-AzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentityExpanded'; + CollectionsViaJsonFilePath = 'Az.Marketplace.private\Get-AzMarketplaceCollectionToSubscriptionMapping_CollectionsViaJsonFilePath'; + CollectionsViaJsonString = 'Az.Marketplace.private\Get-AzMarketplaceCollectionToSubscriptionMapping_CollectionsViaJsonString'; + } + if (('CollectionsExpanded', 'CollectionsViaIdentityExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -783,35 +1028,48 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } <# .Synopsis -Get information about the private store +Fetch all subscriptions in tenant, only for marketplace admin .Description -Get information about the private store +Fetch all subscriptions in tenant, only for marketplace admin .Example -PS C:\> Get-AzMarketplacePrivateStoreV1 - -Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ----- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- -a260d38c-96cf-492d-a340-404d0c4b3ad6 User 12/1/2021 9:01:33 PM User +Get-AzMarketplacePrivateStoreAllSubscriptionInTenant -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse .Notes COMPLEX PARAMETER PROPERTIES @@ -825,38 +1083,38 @@ INPUTOBJECT : Identity Parameter [PrivateStoreId ]: The store ID - must use the tenant ID [RequestApprovalId ]: The request approval ID to get create or update .Link -https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorev1 +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreallsubscriptionintenant #> -function Get-AzMarketplacePrivateStoreV1 { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore])] -[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +function Get-AzMarketplacePrivateStoreAllSubscriptionInTenant { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse])] +[CmdletBinding(DefaultParameterSetName='Fetch', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(ParameterSetName='Get', Mandatory)] - [Alias('PrivateStoreId')] + [Parameter(ParameterSetName='Fetch', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The store ID - must use the tenant ID - ${Id}, + ${PrivateStoreId}, - [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='FetchViaIdentity', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] # Identity Parameter # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, - [Parameter(ParameterSetName='List')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Query')] + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Header')] [System.String] - # Determines if to use cache or DB for serving this request - ${UseCache}, + # The skip token to get the next page. + ${NextPageToken}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -906,18 +1164,40 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ - Get = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreV1_Get'; - GetViaIdentity = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreV1_GetViaIdentity'; - List = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreV1_List'; + Fetch = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreAllSubscriptionInTenant_Fetch'; + FetchViaIdentity = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreAllSubscriptionInTenant_FetchViaIdentity'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -926,78 +1206,80 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } <# .Synopsis -List of offers, regardless the collections +Get a list of all offers in the given collection according to the required contexts. .Description -List of offers, regardless the collections +Get a list of all offers in the given collection according to the required contexts. .Example -PS C:\> Get-AzMarketplaceQueryPrivateStoreOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a - -CreatedAt ETag ModifiedAt OfferDisplayName PrivateStoreId PublisherDisplayName SpecificPlanIdLimitation UniqueOfferId ---------- ---- ---------- ---------------- -------------- -------------------- ------------------------- ------------- - "ed0093ae-0000-0100-0000-61a4dab30000" 3ac32d8c-e888-4dc6-b4ff-be4d755af13a {d3-azure-health-check, data3-azure-optimiser-plan, data3-managed-azure-plan} data3-limite… - "750547d8-0000-0100-0000-61b752010000" 3ac32d8c-e888-4dc6-b4ff-be4d755af13a {mgmt-limited-free, mgmt-assessment} viacode_cons… - "ef00ab05-0000-0100-0000-61a5f12f0000" 3ac32d8c-e888-4dc6-b4ff-be4d755af13a {RedHatEnterpriseLinux72-ARM} RedHat.RHEL_7 - "f300276b-0000-0100-0000-61a7e1af0000" 3ac32d8c-e888-4dc6-b4ff-be4d755af13a {128technology_conductor_hourly_427, 128technology_conductor_hourly_452} 128technolog… - "f300296b-0000-0100-0000-61a7e1af0000" 3ac32d8c-e888-4dc6-b4ff-be4d755af13a {128technology_router_100_hourly_427, 128technology_router_100_hourly_452} 128technolog… +Get-AzMarketplacePrivateStoreCollectionMapOffersToContext -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionId 1f58b5dd-313c-42ed-84fc-f1e351bba7fb,ab3de7bc-7a6e-4e9f-a34a-f6922df453e4 - -.Inputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffers -.Notes -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - -INPUTOBJECT : Identity Parameter - [AdminRequestApprovalId ]: The admin request approval ID to get create or update - [CollectionId ]: The collection ID - [Id ]: Resource identity path - [OfferId ]: The offer ID to update or delete - [PrivateStoreId ]: The store ID - must use the tenant ID - [RequestApprovalId ]: The request approval ID to get create or update +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContext .Link -https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplacequeryprivatestoreoffer +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollectionmapofferstocontext #> -function Get-AzMarketplaceQueryPrivateStoreOffer { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffers])] -[CmdletBinding(DefaultParameterSetName='Query', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Get-AzMarketplacePrivateStoreCollectionMapOffersToContext { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContext])] +[CmdletBinding(DefaultParameterSetName='ListExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(ParameterSetName='Query', Mandatory)] + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The collection ID + ${CollectionId}, + + [Parameter(Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The store ID - must use the tenant ID ${PrivateStoreId}, - [Parameter(ParameterSetName='QueryViaIdentity', Mandatory, ValueFromPipeline)] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] - # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. - ${InputObject}, + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Subscription ids list + ${SubscriptionId}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -1047,17 +1329,42 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ - Query = 'Az.Marketplace.private\Get-AzMarketplaceQueryPrivateStoreOffer_Query'; - QueryViaIdentity = 'Az.Marketplace.private\Get-AzMarketplaceQueryPrivateStoreOffer_QueryViaIdentity'; + ListExpanded = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionMapOffersToContext_ListExpanded'; + } + if (('ListExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -1066,107 +1373,134 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } <# .Synopsis -Update or add an offer to a specific collection of the private store. +Gets information about a specific offer. .Description -Update or add an offer to a specific collection of the private store. +Gets information about a specific offer. .Example -PS C:\>$acc = @{Accessibility = "azure_managedservices_professional"} -PS C:\> New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -OfferId aumatics.azure_managedservices -Plan $acc - -Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ----- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- -aumatics.azure_managedservices +Get-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. -PLAN : Offer plans - [Accessibility ]: Plan accessibility +COLLECTIONINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update .Link -https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollectionoffer +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollectionoffer #> -function New-AzMarketplacePrivateStoreCollectionOffer { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer])] -[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Get-AzMarketplacePrivateStoreCollectionOffer { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( - [Parameter(Mandatory)] + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='GetViaIdentityPrivateStore', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The collection ID ${CollectionId}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='GetViaIdentityCollection', Mandatory)] + [Parameter(ParameterSetName='GetViaIdentityPrivateStore', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The offer ID to update or delete ${OfferId}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The store ID - must use the tenant ID ${PrivateStoreId}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.String] - # Identifier for purposes of race condition - ${ETag}, - - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris]))] - [System.Collections.Hashtable] - # Icon File Uris - ${IconFileUri}, - - [Parameter()] - [AllowEmptyCollection()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan[]] - # Offer plans - # To construct, see NOTES section for PLAN properties and create a hash table. - ${Plan}, + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, - [Parameter()] - [AllowEmptyCollection()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.String[]] - # Plan ids limitation for this offer - ${SpecificPlanIdLimitation}, + [Parameter(ParameterSetName='GetViaIdentityCollection', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + ${CollectionInputObject}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.Management.Automation.SwitchParameter] - # Indicating whether the offer was not updated to db (true = not updated). - # If the allow list is identical to the existed one in db, the offer would not be updated. - ${UpdateSuppressedDueIdempotence}, + [Parameter(ParameterSetName='GetViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -1216,16 +1550,43 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ - CreateExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOffer_CreateExpanded'; + Get = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionOffer_Get'; + GetViaIdentity = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionOffer_GetViaIdentity'; + GetViaIdentityCollection = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionOffer_GetViaIdentityCollection'; + GetViaIdentityPrivateStore = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionOffer_GetViaIdentityPrivateStore'; + List = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionOffer_List'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -1234,91 +1595,109 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } <# .Synopsis -Create or update private store collection +Get a list of all private store rules in the given private store and collection .Description -Create or update private store collection +Get a list of all private store rules in the given private store and collection .Example -PS C:\> New-AzMarketplacePrivateStoreCollection -CollectionName test -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -SubscriptionsList 7f5402e4-e8f4-46bd-9bd1-8d27866a606b - -Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ----- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- -fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 12/13/2021 11:12:27 AM User 12/13/2021 11:12:27 AM User +Get-AzMarketplacePrivateStoreCollectionRule -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update .Link -https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollection +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollectionrule #> -function New-AzMarketplacePrivateStoreCollection { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection])] -[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Get-AzMarketplacePrivateStoreCollectionRule { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse])] +[CmdletBinding(DefaultParameterSetName='Query', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(Mandatory)] + [Parameter(ParameterSetName='Query', Mandatory)] + [Parameter(ParameterSetName='QueryViaIdentityPrivateStore', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The collection ID ${CollectionId}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='Query', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The store ID - must use the tenant ID ${PrivateStoreId}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.Management.Automation.SwitchParameter] - # Indicating whether all subscriptions are selected (=true) or not (=false). - ${AllSubscription}, - - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.String] - # Gets or sets the association with Commercial's Billing Account. - ${Claim}, - - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.String] - # Gets or sets collection name. - ${CollectionName}, - - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.Management.Automation.SwitchParameter] - # Indicating whether the collection is enabled or disabled. - ${Enabled}, + [Parameter(ParameterSetName='QueryViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, - [Parameter()] - [AllowEmptyCollection()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.String[]] - # Gets or sets subscription ids list. - # Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. - # On insert, null is considered as bad request - ${SubscriptionsList}, + [Parameter(ParameterSetName='QueryViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -1368,16 +1747,41 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ - CreateExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollection_CreateExpanded'; + Query = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionRule_Query'; + QueryViaIdentity = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionRule_QueryViaIdentity'; + QueryViaIdentityPrivateStore = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollectionRule_QueryViaIdentityPrivateStore'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -1386,110 +1790,112 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } <# .Synopsis -Changes private store properties +Gets private store collection .Description -Changes private store properties +Gets private store collection .Example -PS C:\> New-AzMarketplacePrivateStore -Id 0000000-0000-00000-0000-000000000000 -Availability 'disabled' -ETag '0000000-0000-00000-0000-000000000000' - - +Get-AzMarketplacePrivateStoreCollection -PrivateStoreId 53425a7b-4ac1-4729-8340-e1da5046212c +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -System.Boolean +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsList .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. -NOTIFICATIONSETTINGRECIPIENT : Gets or sets list of notified recipients for new requests - [PrincipalId ]: Principal ID +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update .Link -https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestore +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollection #> -function New-AzMarketplacePrivateStore { -[OutputType([System.Boolean])] -[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Get-AzMarketplacePrivateStoreCollection { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection], [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsList])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( - [Parameter(Mandatory)] - [Alias('PrivateStoreId')] + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='GetViaIdentityPrivateStore', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] - # The store ID - must use the tenant ID - ${Id}, - - [Parameter()] - [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability])] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability] - # Indicates private store availability - ${Availability}, - - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding]))] - [System.Collections.Hashtable] - # Gets or sets list of branding characteristics - ${Branding}, + # The collection ID + ${CollectionId}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] - # Identifier for purposes of race condition - ${ETag}, - - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.Management.Automation.SwitchParameter] - # Is government - ${IsGov}, - - [Parameter()] - [AllowEmptyCollection()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[]] - # Gets or sets list of notified recipients for new requests - # To construct, see NOTES section for NOTIFICATIONSETTINGRECIPIENT properties and create a hash table. - ${NotificationSettingRecipient}, - - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.Management.Automation.SwitchParameter] - # Gets or sets whether to send email to all marketplace admins for new requests - ${NotificationSettingSendToAllMarketplaceAdmin}, + # The store ID - must use the tenant ID + ${PrivateStoreId}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.String] - # Private Store Name - ${PrivateStoreName}, + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.String] - # Tenant id - ${TenantId}, + [Parameter(ParameterSetName='GetViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -1512,12 +1918,6 @@ param( # SendAsync Pipeline Steps to be prepended to the front of the pipeline ${HttpPipelinePrepend}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] - [System.Management.Automation.SwitchParameter] - # Returns true when the command succeeds - ${PassThru}, - [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] [System.Uri] @@ -1545,16 +1945,42 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ - CreateExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStore_CreateExpanded'; + Get = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollection_Get'; + GetViaIdentity = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollection_GetViaIdentity'; + GetViaIdentityPrivateStore = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollection_GetViaIdentityPrivateStore'; + List = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreCollection_List'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -1563,81 +1989,66 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } <# .Synopsis -Deletes an offer from the given collection of private store. +List new plans notifications .Description -Deletes an offer from the given collection of private store. +List new plans notifications .Example -PS C:\> Remove-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -OfferId aumatics.azure_managedservices +Get-AzMarketplacePrivateStoreNewPlanNotification -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -.Inputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -System.Boolean -.Notes -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - -INPUTOBJECT : Identity Parameter - [AdminRequestApprovalId ]: The admin request approval ID to get create or update - [CollectionId ]: The collection ID - [Id ]: Resource identity path - [OfferId ]: The offer ID to update or delete - [PrivateStoreId ]: The store ID - must use the tenant ID - [RequestApprovalId ]: The request approval ID to get create or update +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsList .Link -https://learn.microsoft.com/powershell/module/az.marketplace/remove-azmarketplaceprivatestorecollectionoffer +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorenewplannotification #> -function Remove-AzMarketplacePrivateStoreCollectionOffer { -[OutputType([System.Boolean])] -[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Get-AzMarketplacePrivateStoreNewPlanNotification { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsList])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(ParameterSetName='Delete', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] - [System.String] - # The collection ID - ${CollectionId}, - - [Parameter(ParameterSetName='Delete', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] - [System.String] - # The offer ID to update or delete - ${OfferId}, - - [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The store ID - must use the tenant ID ${PrivateStoreId}, - [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] - # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. - ${InputObject}, - [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -1660,12 +2071,6 @@ param( # SendAsync Pipeline Steps to be prepended to the front of the pipeline ${HttpPipelinePrepend}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] - [System.Management.Automation.SwitchParameter] - # Returns true when the command succeeds - ${PassThru}, - [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] [System.Uri] @@ -1693,17 +2098,39 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ - Delete = 'Az.Marketplace.private\Remove-AzMarketplacePrivateStoreCollectionOffer_Delete'; - DeleteViaIdentity = 'Az.Marketplace.private\Remove-AzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentity'; + List = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreNewPlanNotification_List'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -1712,76 +2139,66 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } <# .Synopsis -Delete a collection from the given private store. +List all the subscriptions in the private store context .Description -Delete a collection from the given private store. +List all the subscriptions in the private store context .Example -PS C:\> Remove-AzMarketplacePrivateStoreCollection -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 +Get-AzMarketplacePrivateStoreSubscription -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 - -.Inputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -System.Boolean -.Notes -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - -INPUTOBJECT : Identity Parameter - [AdminRequestApprovalId ]: The admin request approval ID to get create or update - [CollectionId ]: The collection ID - [Id ]: Resource identity path - [OfferId ]: The offer ID to update or delete - [PrivateStoreId ]: The store ID - must use the tenant ID - [RequestApprovalId ]: The request approval ID to get create or update +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextList .Link -https://learn.microsoft.com/powershell/module/az.marketplace/remove-azmarketplaceprivatestorecollection +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoresubscription #> -function Remove-AzMarketplacePrivateStoreCollection { -[OutputType([System.Boolean])] -[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Get-AzMarketplacePrivateStoreSubscription { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextList])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(ParameterSetName='Delete', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] - [System.String] - # The collection ID - ${CollectionId}, - - [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The store ID - must use the tenant ID ${PrivateStoreId}, - [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] - # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. - ${InputObject}, - [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -1804,12 +2221,6 @@ param( # SendAsync Pipeline Steps to be prepended to the front of the pipeline ${HttpPipelinePrepend}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] - [System.Management.Automation.SwitchParameter] - # Returns true when the command succeeds - ${PassThru}, - [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] [System.Uri] @@ -1837,17 +2248,39 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ - Delete = 'Az.Marketplace.private\Remove-AzMarketplacePrivateStoreCollection_Delete'; - DeleteViaIdentity = 'Az.Marketplace.private\Remove-AzMarketplacePrivateStoreCollection_DeleteViaIdentity'; + List = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreSubscription_List'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -1856,82 +2289,102 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } <# .Synopsis -Perform an action on bulk collections +List of user's approved offers for the provided offers and subscriptions .Description -Perform an action on bulk collections +List of user's approved offers for the provided offers and subscriptions .Example -PS C:\> Set-AzMarketplaceBulkPrivateStoreCollectionAction -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -Payload @{Action = "EnableCollections"; CollectionId = "3ac32d8c-e888-4dc6-b4ff-be4d755af13a", "fdb889a1-cf3e-49f0-95b8-2bb012fa01f1" } - -Failed Succeeded ------- --------- -{} {DefaultCollection, test} +Get-AzMarketplacePrivateStoreUserOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -OfferId aumatics.azure_managedservices -SubscriptionId 1f58b5dd-313c-42ed-84fc-f1e351bba7fb .Inputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponse +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. -PAYLOAD : Bulk collections action properties - [Action ]: Action to perform (For example: EnableCollections, DisableCollections) - [CollectionId ]: collection ids list that the action is performed on -.Link -https://learn.microsoft.com/powershell/module/az.marketplace/set-azmarketplacebulkprivatestorecollectionaction -#> -function Set-AzMarketplaceBulkPrivateStoreCollectionAction { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponse])] -[CmdletBinding(DefaultParameterSetName='BulkExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreuseroffer +#> +function Get-AzMarketplacePrivateStoreUserOffer { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers])] +[CmdletBinding(DefaultParameterSetName='QueryExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(Mandatory)] + [Parameter(ParameterSetName='QueryExpanded', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The store ID - must use the tenant ID ${PrivateStoreId}, - [Parameter(ParameterSetName='Bulk', Mandatory, ValueFromPipeline)] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload] - # Bulk collections action properties - # To construct, see NOTES section for PAYLOAD properties and create a hash table. - ${Payload}, + [Parameter(ParameterSetName='QueryViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, - [Parameter(ParameterSetName='BulkExpanded')] + [Parameter()] + [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.String] - # Action to perform (For example: EnableCollections, DisableCollections) - ${Action}, + [System.String[]] + # List of offer IDs + ${OfferId}, - [Parameter(ParameterSetName='BulkExpanded')] + [Parameter()] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String[]] - # collection ids list that the action is performed on - ${CollectionId}, + # List of subscription IDs + ${SubscriptionId}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -1981,17 +2434,43 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ - Bulk = 'Az.Marketplace.private\Set-AzMarketplaceBulkPrivateStoreCollectionAction_Bulk'; - BulkExpanded = 'Az.Marketplace.private\Set-AzMarketplaceBulkPrivateStoreCollectionAction_BulkExpanded'; + QueryExpanded = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreUserOffer_QueryExpanded'; + QueryViaIdentityExpanded = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreUserOffer_QueryViaIdentityExpanded'; + } + if (('QueryExpanded', 'QueryViaIdentityExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -2000,107 +2479,95 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } <# .Synopsis -Update or add an offer to a specific collection of the private store. +All rules approved in the private store that are relevant for user subscriptions .Description -Update or add an offer to a specific collection of the private store. +All rules approved in the private store that are relevant for user subscriptions .Example -PS C:\>$acc = @{Accessibility = "azure_managedservices_professional"} -PS C:\> New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -OfferId aumatics.azure_managedservices -Plan $acc - -Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ----- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- -aumatics.azure_managedservices +Get-AzMarketplacePrivateStoreUserRule -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionId 1f58b5dd-313c-42ed-84fc-f1e351bba7fb +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. -PLAN : Offer plans - [Accessibility ]: Plan accessibility +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update .Link -https://learn.microsoft.com/powershell/module/az.marketplace/set-azmarketplaceprivatestorecollectionoffer +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreuserrule #> -function Set-AzMarketplacePrivateStoreCollectionOffer { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer])] -[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Get-AzMarketplacePrivateStoreUserRule { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse])] +[CmdletBinding(DefaultParameterSetName='QueryExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] - [System.String] - # The collection ID - ${CollectionId}, - - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] - [System.String] - # The offer ID to update or delete - ${OfferId}, - - [Parameter(Mandatory)] + [Parameter(ParameterSetName='QueryExpanded', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The store ID - must use the tenant ID ${PrivateStoreId}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.String] - # Identifier for purposes of race condition - ${ETag}, - - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris]))] - [System.Collections.Hashtable] - # Icon File Uris - ${IconFileUri}, - - [Parameter()] - [AllowEmptyCollection()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan[]] - # Offer plans - # To construct, see NOTES section for PLAN properties and create a hash table. - ${Plan}, + [Parameter(ParameterSetName='QueryViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, [Parameter()] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String[]] - # Plan ids limitation for this offer - ${SpecificPlanIdLimitation}, - - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.Management.Automation.SwitchParameter] - # Indicating whether the offer was not updated to db (true = not updated). - # If the allow list is identical to the existed one in db, the offer would not be updated. - ${UpdateSuppressedDueIdempotence}, + # List of subscription IDs + ${SubscriptionId}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -2150,16 +2617,43 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ - UpdateExpanded = 'Az.Marketplace.private\Set-AzMarketplacePrivateStoreCollectionOffer_UpdateExpanded'; + QueryExpanded = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreUserRule_QueryExpanded'; + QueryViaIdentityExpanded = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreUserRule_QueryViaIdentityExpanded'; + } + if (('QueryExpanded', 'QueryViaIdentityExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -2168,91 +2662,94 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } <# .Synopsis -Create or update private store collection +Get information about the private store .Description -Create or update private store collection +Get information about the private store .Example -PS C:\>Set-AzMarketplacePrivateStoreCollection -CollectionId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -AllSubscription - -Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ----- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- -7f5402e4-e8f4-46bd-9bd1-8d27866a606b User 12/13/2021 1:21:57 PM User +Get-AzMarketplacePrivateStoreV1 +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update .Link -https://learn.microsoft.com/powershell/module/az.marketplace/set-azmarketplaceprivatestorecollection +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorev1 #> -function Set-AzMarketplacePrivateStoreCollection { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection])] -[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Get-AzMarketplacePrivateStoreV1 { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] - [System.String] - # The collection ID - ${CollectionId}, - - [Parameter(Mandatory)] + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('PrivateStoreId')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The store ID - must use the tenant ID - ${PrivateStoreId}, - - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.Management.Automation.SwitchParameter] - # Indicating whether all subscriptions are selected (=true) or not (=false). - ${AllSubscription}, + ${Id}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.String] - # Gets or sets the association with Commercial's Billing Account. - ${Claim}, + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Query')] [System.String] - # Gets or sets collection name. - ${CollectionName}, - - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.Management.Automation.SwitchParameter] - # Indicating whether the collection is enabled or disabled. - ${Enabled}, - - [Parameter()] - [AllowEmptyCollection()] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.String[]] - # Gets or sets subscription ids list. - # Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. - # On insert, null is considered as bad request - ${SubscriptionsList}, + # Determines if to use cache or DB for serving this request + ${UseCache}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -2302,16 +2799,41 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ - UpdateExpanded = 'Az.Marketplace.private\Set-AzMarketplacePrivateStoreCollection_UpdateExpanded'; + Get = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreV1_Get'; + GetViaIdentity = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreV1_GetViaIdentity'; + List = 'Az.Marketplace.private\Get-AzMarketplacePrivateStoreV1_List'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -2320,110 +2842,2853 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } <# .Synopsis -Changes private store properties +List of offers, regardless the collections .Description -Changes private store properties +List of offers, regardless the collections .Example -PS C:\> Set-AzMarketplacePrivateStore -Id 0000000-0000-00000-0000-000000000000 -Availability 'disabled' -ETag '0000000-0000-00000-0000-000000000000' - - +Get-AzMarketplaceQueryPrivateStoreOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -System.Boolean +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. -NOTIFICATIONSETTINGRECIPIENT : Gets or sets list of notified recipients for new requests - [PrincipalId ]: Principal ID +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update .Link -https://learn.microsoft.com/powershell/module/az.marketplace/set-azmarketplaceprivatestore +https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplacequeryprivatestoreoffer #> -function Set-AzMarketplacePrivateStore { -[OutputType([System.Boolean])] -[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Get-AzMarketplaceQueryPrivateStoreOffer { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers])] +[CmdletBinding(DefaultParameterSetName='Query', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(Mandatory)] - [Alias('PrivateStoreId')] + [Parameter(ParameterSetName='Query', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The store ID - must use the tenant ID - ${Id}, - - [Parameter()] - [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability])] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability] - # Indicates private store availability - ${Availability}, + ${PrivateStoreId}, - [Parameter()] + [Parameter(ParameterSetName='QueryViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Query = 'Az.Marketplace.private\Get-AzMarketplaceQueryPrivateStoreOffer_Query'; + QueryViaIdentity = 'Az.Marketplace.private\Get-AzMarketplaceQueryPrivateStoreOffer_QueryViaIdentity'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Upsert an offer with multiple context details. +.Description +Upsert an offer with multiple context details. +.Example +$plan1 = @{ + context = "1f58b5dd-313c-42ed-84fc-f1e351bba7fb" + planId = "plan1" +} + +$plan2 = @{ + context = "ab3de7bc-7a6e-4e9f-a34a-f6922df453e4" + planId = "plan2" +} + +$plans = @($plan1,$plan2) + +New-AzMarketplacePrivateStoreCollectionOfferMultiContext -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -OfferId test_pmc2pc1.vm_4plans -PlansContext $plans + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +COLLECTIONINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +PLANSCONTEXT : . + [Context ]: Plan's context, e.g. subscription ID, tenant ID. + [PlanId >]: List of plan IDs. + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollectionoffermulticontext +#> +function New-AzMarketplacePrivateStoreCollectionOfferMultiContext { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer])] +[CmdletBinding(DefaultParameterSetName='OfferExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The offer ID to update or delete + ${OfferId}, + + [Parameter(ParameterSetName='OfferExpanded', Mandatory)] + [Parameter(ParameterSetName='OfferViaIdentityPrivateStoreExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The collection ID + ${CollectionId}, + + [Parameter(ParameterSetName='OfferExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='OfferViaIdentityCollectionExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + ${CollectionInputObject}, + + [Parameter(ParameterSetName='OfferViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='OfferViaIdentityPrivateStoreExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding]))] - [System.Collections.Hashtable] - # Gets or sets list of branding characteristics - ${Branding}, + [System.String] + # The offer's eTag. + ${ETag}, + + [Parameter()] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails[]] + # . + # To construct, see NOTES section for PLANSCONTEXT properties and create a hash table. + ${PlansContext}, + + [Parameter(ParameterSetName='OfferExpanded')] + [Parameter(ParameterSetName='OfferViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='OfferViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # The offer ID which contains the plans. + ${PropertiesOfferId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + OfferExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOfferMultiContext_OfferExpanded'; + OfferViaIdentityCollectionExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityCollectionExpanded'; + OfferViaIdentityExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityExpanded'; + OfferViaIdentityPrivateStoreExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityPrivateStoreExpanded'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Update or add an offer to a specific collection of the private store. +.Description +Update or add an offer to a specific collection of the private store. +.Example +$acc = @{Accessibility = "azure_managedservices_professional"} +New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -OfferId aumatics.azure_managedservices -Plan $acc + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +COLLECTIONINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +PAYLOAD : The privateStore offer data structure. + [ETag ]: Identifier for purposes of race condition + [IconFileUri ]: Icon File Uris + [(Any) ]: This indicates any property can be added to this object. + [Plan >]: Offer plans + [Accessibility ]: Plan accessibility + [SpecificPlanIdsLimitation >]: Plan ids limitation for this offer + [UpdateSuppressedDueIdempotence ]: Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated. + +PLAN : Offer plans + [Accessibility ]: Plan accessibility + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollectionoffer +#> +function New-AzMarketplacePrivateStoreCollectionOffer { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The offer ID to update or delete + ${OfferId}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStore', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The collection ID + ${CollectionId}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='CreateViaIdentityCollection', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentityCollectionExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + ${CollectionInputObject}, + + [Parameter(ParameterSetName='CreateViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Identifier for purposes of race condition + ${ETag}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris]))] + [System.Collections.Hashtable] + # Icon File Uris + ${IconFileUri}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[]] + # Offer plans + # To construct, see NOTES section for PLAN properties and create a hash table. + ${Plan}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String[]] + # Plan ids limitation for this offer + ${SpecificPlanIdLimitation}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicating whether the offer was not updated to db (true = not updated). + # If the allow list is identical to the existed one in db, the offer would not be updated. + ${UpdateSuppressedDueIdempotence}, + + [Parameter(ParameterSetName='CreateViaIdentityCollection', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer] + # The privateStore offer data structure. + # To construct, see NOTES section for PAYLOAD properties and create a hash table. + ${Payload}, + + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOffer_CreateExpanded'; + CreateViaIdentityCollection = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityCollection'; + CreateViaIdentityCollectionExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityCollectionExpanded'; + CreateViaIdentityPrivateStore = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityPrivateStore'; + CreateViaIdentityPrivateStoreExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityPrivateStoreExpanded'; + CreateViaJsonFilePath = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOffer_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOffer_CreateViaJsonString'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create private store collection +.Description +Create private store collection +.Example +New-AzMarketplacePrivateStoreCollection -CollectionName test -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -SubscriptionsList 7f5402e4-e8f4-46bd-9bd1-8d27866a606b + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +PAYLOAD : The Collection data structure. + [AllSubscription ]: Indicating whether all subscriptions are selected (=true) or not (=false). + [Claim ]: Gets or sets the association with Commercial's Billing Account. + [CollectionName ]: Gets or sets collection name. + [Enabled ]: Indicating whether the collection is enabled or disabled. + [SubscriptionsList >]: Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollection +#> +function New-AzMarketplacePrivateStoreCollection { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The collection ID + ${CollectionId}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='CreateViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicating whether all subscriptions are selected (=true) or not (=false). + ${AllSubscription}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Gets or sets the association with Commercial's Billing Account. + ${Claim}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Gets or sets collection name. + ${CollectionName}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicating whether the collection is enabled or disabled. + ${Enabled}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Parameter(ParameterSetName='CreateViaIdentityPrivateStoreExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String[]] + # Gets or sets subscription ids list. + # Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. + # On insert, null is considered as bad request + ${SubscriptionsList}, + + [Parameter(ParameterSetName='CreateViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection] + # The Collection data structure. + # To construct, see NOTES section for PAYLOAD properties and create a hash table. + ${Payload}, + + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollection_CreateExpanded'; + CreateViaIdentityPrivateStore = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollection_CreateViaIdentityPrivateStore'; + CreateViaIdentityPrivateStoreExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollection_CreateViaIdentityPrivateStoreExpanded'; + CreateViaJsonFilePath = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollection_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollection_CreateViaJsonString'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Changes private store properties +.Description +Changes private store properties +.Example +New-AzMarketplacePrivateStore -Id 0000000-0000-00000-0000-000000000000 -Availability 'disabled' -ETag '0000000-0000-00000-0000-000000000000' + +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +NOTIFICATIONSETTINGRECIPIENT : Gets or sets list of notified recipients for new requests + [PrincipalId ]: Principal ID +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestore +#> +function New-AzMarketplacePrivateStore { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('PrivateStoreId')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${Id}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("enabled", "disabled")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Indicates private store availability + ${Availability}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding]))] + [System.Collections.Hashtable] + # Gets or sets list of branding characteristics + ${Branding}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Identifier for purposes of race condition + ${ETag}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Is government + ${IsGov}, + + [Parameter(ParameterSetName='CreateExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient[]] + # Gets or sets list of notified recipients for new requests + # To construct, see NOTES section for NOTIFICATIONSETTINGRECIPIENT properties and create a hash table. + ${NotificationSettingRecipient}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Gets or sets whether to send email to all marketplace admins for new requests + ${NotificationSettingSendToAllMarketplaceAdmin}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Private Store Name + ${PrivateStoreName}, + + [Parameter(ParameterSetName='CreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Tenant id + ${TenantId}, + + [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Path of Json file supplied to the Create operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Json string supplied to the Create operation + ${JsonString}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + CreateExpanded = 'Az.Marketplace.private\New-AzMarketplacePrivateStore_CreateExpanded'; + CreateViaJsonFilePath = 'Az.Marketplace.private\New-AzMarketplacePrivateStore_CreateViaJsonFilePath'; + CreateViaJsonString = 'Az.Marketplace.private\New-AzMarketplacePrivateStore_CreateViaJsonString'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Deletes an offer from the given collection of private store. +.Description +Deletes an offer from the given collection of private store. +.Example +Remove-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -OfferId aumatics.azure_managedservices + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +COLLECTIONINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/remove-azmarketplaceprivatestorecollectionoffer +#> +function Remove-AzMarketplacePrivateStoreCollectionOffer { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteViaIdentityPrivateStore', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The collection ID + ${CollectionId}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteViaIdentityCollection', Mandatory)] + [Parameter(ParameterSetName='DeleteViaIdentityPrivateStore', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The offer ID to update or delete + ${OfferId}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='DeleteViaIdentityCollection', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + ${CollectionInputObject}, + + [Parameter(ParameterSetName='DeleteViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Marketplace.private\Remove-AzMarketplacePrivateStoreCollectionOffer_Delete'; + DeleteViaIdentity = 'Az.Marketplace.private\Remove-AzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentity'; + DeleteViaIdentityCollection = 'Az.Marketplace.private\Remove-AzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentityCollection'; + DeleteViaIdentityPrivateStore = 'Az.Marketplace.private\Remove-AzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentityPrivateStore'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Delete a collection from the given private store. +.Description +Delete a collection from the given private store. +.Example +Remove-AzMarketplacePrivateStoreCollection -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/remove-azmarketplaceprivatestorecollection +#> +function Remove-AzMarketplacePrivateStoreCollection { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteViaIdentityPrivateStore', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The collection ID + ${CollectionId}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='DeleteViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Delete = 'Az.Marketplace.private\Remove-AzMarketplacePrivateStoreCollection_Delete'; + DeleteViaIdentity = 'Az.Marketplace.private\Remove-AzMarketplacePrivateStoreCollection_DeleteViaIdentity'; + DeleteViaIdentityPrivateStore = 'Az.Marketplace.private\Remove-AzMarketplacePrivateStoreCollection_DeleteViaIdentityPrivateStore'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Perform an action on bulk collections +.Description +Perform an action on bulk collections +.Example +Set-AzMarketplaceBulkPrivateStoreCollectionAction -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -Payload @{Action = "EnableCollections"; CollectionId = "3ac32d8c-e888-4dc6-b4ff-be4d755af13a", "fdb889a1-cf3e-49f0-95b8-2bb012fa01f1" } + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +PAYLOAD : Bulk collections action properties + [Action ]: Action to perform (For example: EnableCollections, DisableCollections) + [CollectionId >]: collection ids list that the action is performed on +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/set-azmarketplacebulkprivatestorecollectionaction +#> +function Set-AzMarketplaceBulkPrivateStoreCollectionAction { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse])] +[CmdletBinding(DefaultParameterSetName='BulkExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='Bulk', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload] + # Bulk collections action properties + # To construct, see NOTES section for PAYLOAD properties and create a hash table. + ${Payload}, + + [Parameter(ParameterSetName='BulkExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Action to perform (For example: EnableCollections, DisableCollections) + ${Action}, + + [Parameter(ParameterSetName='BulkExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String[]] + # collection ids list that the action is performed on + ${CollectionId}, + + [Parameter(ParameterSetName='BulkViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Path of Json file supplied to the Bulk operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='BulkViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Json string supplied to the Bulk operation + ${JsonString}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Bulk = 'Az.Marketplace.private\Set-AzMarketplaceBulkPrivateStoreCollectionAction_Bulk'; + BulkExpanded = 'Az.Marketplace.private\Set-AzMarketplaceBulkPrivateStoreCollectionAction_BulkExpanded'; + BulkViaJsonFilePath = 'Az.Marketplace.private\Set-AzMarketplaceBulkPrivateStoreCollectionAction_BulkViaJsonFilePath'; + BulkViaJsonString = 'Az.Marketplace.private\Set-AzMarketplaceBulkPrivateStoreCollectionAction_BulkViaJsonString'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Update or add an offer to a specific collection of the private store. +.Description +Update or add an offer to a specific collection of the private store. +.Example +$acc = @{Accessibility = "azure_managedservices_professional"} +New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -OfferId aumatics.azure_managedservices -Plan $acc + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +PLAN : Offer plans + [Accessibility ]: Plan accessibility +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/set-azmarketplaceprivatestorecollectionoffer +#> +function Set-AzMarketplacePrivateStoreCollectionOffer { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The collection ID + ${CollectionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The offer ID to update or delete + ${OfferId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Identifier for purposes of race condition + ${ETag}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris]))] + [System.Collections.Hashtable] + # Icon File Uris + ${IconFileUri}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[]] + # Offer plans + # To construct, see NOTES section for PLAN properties and create a hash table. + ${Plan}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String[]] + # Plan ids limitation for this offer + ${SpecificPlanIdLimitation}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicating whether the offer was not updated to db (true = not updated). + # If the allow list is identical to the existed one in db, the offer would not be updated. + ${UpdateSuppressedDueIdempotence}, + + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Marketplace.private\Set-AzMarketplacePrivateStoreCollectionOffer_UpdateExpanded'; + UpdateViaJsonFilePath = 'Az.Marketplace.private\Set-AzMarketplacePrivateStoreCollectionOffer_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.Marketplace.private\Set-AzMarketplacePrivateStoreCollectionOffer_UpdateViaJsonString'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create private store collection +.Description +Create private store collection +.Example +Set-AzMarketplacePrivateStoreCollection -CollectionId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -AllSubscription + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/set-azmarketplaceprivatestorecollection +#> +function Set-AzMarketplacePrivateStoreCollection { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The collection ID + ${CollectionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicating whether all subscriptions are selected (=true) or not (=false). + ${AllSubscription}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Gets or sets the association with Commercial's Billing Account. + ${Claim}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Gets or sets collection name. + ${CollectionName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicating whether the collection is enabled or disabled. + ${Enabled}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String[]] + # Gets or sets subscription ids list. + # Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. + # On insert, null is considered as bad request + ${SubscriptionsList}, + + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Marketplace.private\Set-AzMarketplacePrivateStoreCollection_UpdateExpanded'; + UpdateViaJsonFilePath = 'Az.Marketplace.private\Set-AzMarketplacePrivateStoreCollection_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.Marketplace.private\Set-AzMarketplacePrivateStoreCollection_UpdateViaJsonString'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Changes private store properties +.Description +Changes private store properties +.Example +Set-AzMarketplacePrivateStore -Id 0000000-0000-00000-0000-000000000000 -Availability 'disabled' -ETag '0000000-0000-00000-0000-000000000000' + +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +NOTIFICATIONSETTINGRECIPIENT : Gets or sets list of notified recipients for new requests + [PrincipalId ]: Principal ID +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/set-azmarketplaceprivatestore +#> +function Set-AzMarketplacePrivateStore { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('PrivateStoreId')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${Id}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("enabled", "disabled")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Indicates private store availability + ${Availability}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding]))] + [System.Collections.Hashtable] + # Gets or sets list of branding characteristics + ${Branding}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Identifier for purposes of race condition + ${ETag}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Is government + ${IsGov}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient[]] + # Gets or sets list of notified recipients for new requests + # To construct, see NOTES section for NOTIFICATIONSETTINGRECIPIENT properties and create a hash table. + ${NotificationSettingRecipient}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Gets or sets whether to send email to all marketplace admins for new requests + ${NotificationSettingSendToAllMarketplaceAdmin}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Private Store Name + ${PrivateStoreName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Tenant id + ${TenantId}, + + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Marketplace.private\Set-AzMarketplacePrivateStore_UpdateExpanded'; + UpdateViaJsonFilePath = 'Az.Marketplace.private\Set-AzMarketplacePrivateStore_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.Marketplace.private\Set-AzMarketplacePrivateStore_UpdateViaJsonString'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Query whether exists any offer in the collections. +.Description +Query whether exists any offer in the collections. +.Example +Test-AzMarketplacePrivateStoreAnyExistingOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/test-azmarketplaceprivatestoreanyexistingoffer +#> +function Test-AzMarketplacePrivateStoreAnyExistingOffer { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse])] +[CmdletBinding(DefaultParameterSetName='Any', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Any', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='AnyViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Any = 'Az.Marketplace.private\Test-AzMarketplacePrivateStoreAnyExistingOffer_Any'; + AnyViaIdentity = 'Az.Marketplace.private\Test-AzMarketplacePrivateStoreAnyExistingOffer_AnyViaIdentity'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Update or add an offer to a specific collection of the private store. +.Description +Update or add an offer to a specific collection of the private store. +.Example +Update-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId 8c7a91db-cd41-43b6-af47-2e869654126d -OfferId "aumatics.azure_managedservices" -SpecificPlanIdLimitation $null + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +COLLECTIONINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +PAYLOAD : The privateStore offer data structure. + [ETag ]: Identifier for purposes of race condition + [IconFileUri ]: Icon File Uris + [(Any) ]: This indicates any property can be added to this object. + [Plan >]: Offer plans + [Accessibility ]: Plan accessibility + [SpecificPlanIdsLimitation >]: Plan ids limitation for this offer + [UpdateSuppressedDueIdempotence ]: Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated. + +PLAN : Offer plans + [Accessibility ]: Plan accessibility + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/update-azmarketplaceprivatestorecollectionoffer +#> +function Update-AzMarketplacePrivateStoreCollectionOffer { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStore', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The collection ID + ${CollectionId}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityCollection', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityCollectionExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStore', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The offer ID to update or delete + ${OfferId}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='UpdateViaIdentityCollection', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UpdateViaIdentityCollectionExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + ${CollectionInputObject}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String] # Identifier for purposes of race condition ${ETag}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.Management.Automation.SwitchParameter] - # Is government - ${IsGov}, + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris]))] + [System.Collections.Hashtable] + # Icon File Uris + ${IconFileUri}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[]] - # Gets or sets list of notified recipients for new requests - # To construct, see NOTES section for NOTIFICATIONSETTINGRECIPIENT properties and create a hash table. - ${NotificationSettingRecipient}, + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[]] + # Offer plans + # To construct, see NOTES section for PLAN properties and create a hash table. + ${Plan}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] + [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.Management.Automation.SwitchParameter] - # Gets or sets whether to send email to all marketplace admins for new requests - ${NotificationSettingSendToAllMarketplaceAdmin}, + [System.String[]] + # Plan ids limitation for this offer + ${SpecificPlanIdLimitation}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.String] - # Private Store Name - ${PrivateStoreName}, + [System.Management.Automation.SwitchParameter] + # Indicating whether the offer was not updated to db (true = not updated). + # If the allow list is identical to the existed one in db, the offer would not be updated. + ${UpdateSuppressedDueIdempotence}, - [Parameter()] + [Parameter(ParameterSetName='UpdateViaIdentityCollection', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [System.String] - # Tenant id - ${TenantId}, + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer] + # The privateStore offer data structure. + # To construct, see NOTES section for PAYLOAD properties and create a hash table. + ${Payload}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -2446,11 +5711,264 @@ param( # SendAsync Pipeline Steps to be prepended to the front of the pipeline ${HttpPipelinePrepend}, + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollectionOffer_UpdateExpanded'; + UpdateViaIdentityCollection = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityCollection'; + UpdateViaIdentityCollectionExpanded = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityCollectionExpanded'; + UpdateViaIdentityExpanded = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityExpanded'; + UpdateViaIdentityPrivateStore = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityPrivateStore'; + UpdateViaIdentityPrivateStoreExpanded = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityPrivateStoreExpanded'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} + +<# +.Synopsis +Create private store collection +.Description +Create private store collection +.Example +Update-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId 8c7a91db-cd41-43b6-af47-2e869654126d -Enabled + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +PAYLOAD : The Collection data structure. + [AllSubscription ]: Indicating whether all subscriptions are selected (=true) or not (=false). + [Claim ]: Gets or sets the association with Commercial's Billing Account. + [CollectionName ]: Gets or sets collection name. + [Enabled ]: Indicating whether the collection is enabled or disabled. + [SubscriptionsList >]: Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/update-azmarketplaceprivatestorecollection +#> +function Update-AzMarketplacePrivateStoreCollection { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStore', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The collection ID + ${CollectionId}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicating whether all subscriptions are selected (=true) or not (=false). + ${AllSubscription}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Gets or sets the association with Commercial's Billing Account. + ${Claim}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Gets or sets collection name. + ${CollectionName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicating whether the collection is enabled or disabled. + ${Enabled}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String[]] + # Gets or sets subscription ids list. + # Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. + # On insert, null is considered as bad request + ${SubscriptionsList}, + + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection] + # The Collection data structure. + # To construct, see NOTES section for PAYLOAD properties and create a hash table. + ${Payload}, + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] [System.Management.Automation.SwitchParameter] - # Returns true when the command succeeds - ${PassThru}, + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] @@ -2479,16 +5997,42 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ - UpdateExpanded = 'Az.Marketplace.private\Set-AzMarketplacePrivateStore_UpdateExpanded'; + UpdateExpanded = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollection_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollection_UpdateViaIdentityExpanded'; + UpdateViaIdentityPrivateStore = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollection_UpdateViaIdentityPrivateStore'; + UpdateViaIdentityPrivateStoreExpanded = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollection_UpdateViaIdentityPrivateStoreExpanded'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -2497,15 +6041,32 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/exports/Remove-AzMarketplacePrivateStoreCollection.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Remove-AzMarketplacePrivateStoreCollection.ps1 index b2e0dd0b7fb2..f55c055d27f1 100644 --- a/src/Marketplace/Marketplace.Autorest/exports/Remove-AzMarketplacePrivateStoreCollection.ps1 +++ b/src/Marketplace/Marketplace.Autorest/exports/Remove-AzMarketplacePrivateStoreCollection.ps1 @@ -20,8 +20,7 @@ Delete a collection from the given private store. .Description Delete a collection from the given private store. .Example -PS C:\> Remove-AzMarketplacePrivateStoreCollection -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 - +Remove-AzMarketplacePrivateStoreCollection -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity @@ -39,6 +38,14 @@ INPUTOBJECT : Identity Parameter [OfferId ]: The offer ID to update or delete [PrivateStoreId ]: The store ID - must use the tenant ID [RequestApprovalId ]: The request approval ID to get create or update + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update .Link https://learn.microsoft.com/powershell/module/az.marketplace/remove-azmarketplaceprivatestorecollection #> @@ -47,6 +54,7 @@ function Remove-AzMarketplacePrivateStoreCollection { [CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteViaIdentityPrivateStore', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The collection ID @@ -65,12 +73,20 @@ param( # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, + [Parameter(ParameterSetName='DeleteViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -126,17 +142,41 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ Delete = 'Az.Marketplace.private\Remove-AzMarketplacePrivateStoreCollection_Delete'; DeleteViaIdentity = 'Az.Marketplace.private\Remove-AzMarketplacePrivateStoreCollection_DeleteViaIdentity'; + DeleteViaIdentityPrivateStore = 'Az.Marketplace.private\Remove-AzMarketplacePrivateStoreCollection_DeleteViaIdentityPrivateStore'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -145,15 +185,32 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/exports/Remove-AzMarketplacePrivateStoreCollectionOffer.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Remove-AzMarketplacePrivateStoreCollectionOffer.ps1 index 87a0192aa13e..b3c644cfc877 100644 --- a/src/Marketplace/Marketplace.Autorest/exports/Remove-AzMarketplacePrivateStoreCollectionOffer.ps1 +++ b/src/Marketplace/Marketplace.Autorest/exports/Remove-AzMarketplacePrivateStoreCollectionOffer.ps1 @@ -20,7 +20,7 @@ Deletes an offer from the given collection of private store. .Description Deletes an offer from the given collection of private store. .Example -PS C:\> Remove-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -OfferId aumatics.azure_managedservices +Remove-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -OfferId aumatics.azure_managedservices .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity @@ -31,6 +31,14 @@ COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. +COLLECTIONINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + INPUTOBJECT : Identity Parameter [AdminRequestApprovalId ]: The admin request approval ID to get create or update [CollectionId ]: The collection ID @@ -38,6 +46,14 @@ INPUTOBJECT : Identity Parameter [OfferId ]: The offer ID to update or delete [PrivateStoreId ]: The store ID - must use the tenant ID [RequestApprovalId ]: The request approval ID to get create or update + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update .Link https://learn.microsoft.com/powershell/module/az.marketplace/remove-azmarketplaceprivatestorecollectionoffer #> @@ -46,12 +62,15 @@ function Remove-AzMarketplacePrivateStoreCollectionOffer { [CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteViaIdentityPrivateStore', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The collection ID ${CollectionId}, [Parameter(ParameterSetName='Delete', Mandatory)] + [Parameter(ParameterSetName='DeleteViaIdentityCollection', Mandatory)] + [Parameter(ParameterSetName='DeleteViaIdentityPrivateStore', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] [System.String] # The offer ID to update or delete @@ -70,12 +89,27 @@ param( # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, + [Parameter(ParameterSetName='DeleteViaIdentityCollection', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + ${CollectionInputObject}, + + [Parameter(ParameterSetName='DeleteViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -131,17 +165,42 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ Delete = 'Az.Marketplace.private\Remove-AzMarketplacePrivateStoreCollectionOffer_Delete'; DeleteViaIdentity = 'Az.Marketplace.private\Remove-AzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentity'; + DeleteViaIdentityCollection = 'Az.Marketplace.private\Remove-AzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentityCollection'; + DeleteViaIdentityPrivateStore = 'Az.Marketplace.private\Remove-AzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentityPrivateStore'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -150,15 +209,32 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/exports/Set-AzMarketplaceBulkPrivateStoreCollectionAction.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Set-AzMarketplaceBulkPrivateStoreCollectionAction.ps1 index 90a655b5db97..35a0fe96b7ad 100644 --- a/src/Marketplace/Marketplace.Autorest/exports/Set-AzMarketplaceBulkPrivateStoreCollectionAction.ps1 +++ b/src/Marketplace/Marketplace.Autorest/exports/Set-AzMarketplaceBulkPrivateStoreCollectionAction.ps1 @@ -20,16 +20,12 @@ Perform an action on bulk collections .Description Perform an action on bulk collections .Example -PS C:\> Set-AzMarketplaceBulkPrivateStoreCollectionAction -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -Payload @{Action = "EnableCollections"; CollectionId = "3ac32d8c-e888-4dc6-b4ff-be4d755af13a", "fdb889a1-cf3e-49f0-95b8-2bb012fa01f1" } - -Failed Succeeded ------- --------- -{} {DefaultCollection, test} +Set-AzMarketplaceBulkPrivateStoreCollectionAction -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -Payload @{Action = "EnableCollections"; CollectionId = "3ac32d8c-e888-4dc6-b4ff-be4d755af13a", "fdb889a1-cf3e-49f0-95b8-2bb012fa01f1" } .Inputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponse +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse .Notes COMPLEX PARAMETER PROPERTIES @@ -37,12 +33,12 @@ To create the parameters described below, construct a hash table containing the PAYLOAD : Bulk collections action properties [Action ]: Action to perform (For example: EnableCollections, DisableCollections) - [CollectionId ]: collection ids list that the action is performed on + [CollectionId >]: collection ids list that the action is performed on .Link https://learn.microsoft.com/powershell/module/az.marketplace/set-azmarketplacebulkprivatestorecollectionaction #> function Set-AzMarketplaceBulkPrivateStoreCollectionAction { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponse])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse])] [CmdletBinding(DefaultParameterSetName='BulkExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -53,7 +49,7 @@ param( [Parameter(ParameterSetName='Bulk', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload] # Bulk collections action properties # To construct, see NOTES section for PAYLOAD properties and create a hash table. ${Payload}, @@ -71,12 +67,25 @@ param( # collection ids list that the action is performed on ${CollectionId}, + [Parameter(ParameterSetName='BulkViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Path of Json file supplied to the Bulk operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='BulkViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Json string supplied to the Bulk operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -126,17 +135,42 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ Bulk = 'Az.Marketplace.private\Set-AzMarketplaceBulkPrivateStoreCollectionAction_Bulk'; BulkExpanded = 'Az.Marketplace.private\Set-AzMarketplaceBulkPrivateStoreCollectionAction_BulkExpanded'; + BulkViaJsonFilePath = 'Az.Marketplace.private\Set-AzMarketplaceBulkPrivateStoreCollectionAction_BulkViaJsonFilePath'; + BulkViaJsonString = 'Az.Marketplace.private\Set-AzMarketplaceBulkPrivateStoreCollectionAction_BulkViaJsonString'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -145,15 +179,32 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/exports/Set-AzMarketplacePrivateStore.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Set-AzMarketplacePrivateStore.ps1 index 3de55a29e3b1..80dae0b82a0b 100644 --- a/src/Marketplace/Marketplace.Autorest/exports/Set-AzMarketplacePrivateStore.ps1 +++ b/src/Marketplace/Marketplace.Autorest/exports/Set-AzMarketplacePrivateStore.ps1 @@ -20,9 +20,7 @@ Changes private store properties .Description Changes private store properties .Example -PS C:\> Set-AzMarketplacePrivateStore -Id 0000000-0000-00000-0000-000000000000 -Availability 'disabled' -ETag '0000000-0000-00000-0000-000000000000' - - +Set-AzMarketplacePrivateStore -Id 0000000-0000-00000-0000-000000000000 -Availability 'disabled' -ETag '0000000-0000-00000-0000-000000000000' .Outputs System.Boolean @@ -47,64 +45,77 @@ param( # The store ID - must use the tenant ID ${Id}, - [Parameter()] - [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability])] + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("enabled", "disabled")] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability] + [System.String] # Indicates private store availability ${Availability}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding]))] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding]))] [System.Collections.Hashtable] # Gets or sets list of branding characteristics ${Branding}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String] # Identifier for purposes of race condition ${ETag}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.Management.Automation.SwitchParameter] # Is government ${IsGov}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[]] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient[]] # Gets or sets list of notified recipients for new requests # To construct, see NOTES section for NOTIFICATIONSETTINGRECIPIENT properties and create a hash table. ${NotificationSettingRecipient}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.Management.Automation.SwitchParameter] # Gets or sets whether to send email to all marketplace admins for new requests ${NotificationSettingSendToAllMarketplaceAdmin}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String] # Private Store Name ${PrivateStoreName}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String] # Tenant id ${TenantId}, + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -160,16 +171,41 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ UpdateExpanded = 'Az.Marketplace.private\Set-AzMarketplacePrivateStore_UpdateExpanded'; + UpdateViaJsonFilePath = 'Az.Marketplace.private\Set-AzMarketplacePrivateStore_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.Marketplace.private\Set-AzMarketplacePrivateStore_UpdateViaJsonString'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -178,15 +214,32 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/exports/Set-AzMarketplacePrivateStoreCollection.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Set-AzMarketplacePrivateStoreCollection.ps1 index 39a7f57322e6..32949e919608 100644 --- a/src/Marketplace/Marketplace.Autorest/exports/Set-AzMarketplacePrivateStoreCollection.ps1 +++ b/src/Marketplace/Marketplace.Autorest/exports/Set-AzMarketplacePrivateStoreCollection.ps1 @@ -16,23 +16,19 @@ <# .Synopsis -Create or update private store collection +Create private store collection .Description -Create or update private store collection +Create private store collection .Example -PS C:\>Set-AzMarketplacePrivateStoreCollection -CollectionId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -AllSubscription - -Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ----- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- -7f5402e4-e8f4-46bd-9bd1-8d27866a606b User 12/13/2021 1:21:57 PM User +Set-AzMarketplacePrivateStoreCollection -CollectionId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -AllSubscription .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection .Link https://learn.microsoft.com/powershell/module/az.marketplace/set-azmarketplaceprivatestorecollection #> function Set-AzMarketplacePrivateStoreCollection { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection])] [CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -47,31 +43,31 @@ param( # The store ID - must use the tenant ID ${PrivateStoreId}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.Management.Automation.SwitchParameter] # Indicating whether all subscriptions are selected (=true) or not (=false). ${AllSubscription}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String] # Gets or sets the association with Commercial's Billing Account. ${Claim}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String] # Gets or sets collection name. ${CollectionName}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.Management.Automation.SwitchParameter] # Indicating whether the collection is enabled or disabled. ${Enabled}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String[]] @@ -80,12 +76,25 @@ param( # On insert, null is considered as bad request ${SubscriptionsList}, + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -135,16 +144,41 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ UpdateExpanded = 'Az.Marketplace.private\Set-AzMarketplacePrivateStoreCollection_UpdateExpanded'; + UpdateViaJsonFilePath = 'Az.Marketplace.private\Set-AzMarketplacePrivateStoreCollection_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.Marketplace.private\Set-AzMarketplacePrivateStoreCollection_UpdateViaJsonString'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -153,15 +187,32 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/exports/Set-AzMarketplacePrivateStoreCollectionOffer.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Set-AzMarketplacePrivateStoreCollectionOffer.ps1 index b00dcdd191fe..1c6c15a7043d 100644 --- a/src/Marketplace/Marketplace.Autorest/exports/Set-AzMarketplacePrivateStoreCollectionOffer.ps1 +++ b/src/Marketplace/Marketplace.Autorest/exports/Set-AzMarketplacePrivateStoreCollectionOffer.ps1 @@ -20,27 +20,23 @@ Update or add an offer to a specific collection of the private store. .Description Update or add an offer to a specific collection of the private store. .Example -PS C:\>$acc = @{Accessibility = "azure_managedservices_professional"} -PS C:\> New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -OfferId aumatics.azure_managedservices -Plan $acc - -Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ----- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- -aumatics.azure_managedservices +$acc = @{Accessibility = "azure_managedservices_professional"} +New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -OfferId aumatics.azure_managedservices -Plan $acc .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer .Notes COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. PLAN : Offer plans - [Accessibility ]: Plan accessibility + [Accessibility ]: Plan accessibility .Link https://learn.microsoft.com/powershell/module/az.marketplace/set-azmarketplaceprivatestorecollectionoffer #> function Set-AzMarketplacePrivateStoreCollectionOffer { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer])] [CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -61,47 +57,60 @@ param( # The store ID - must use the tenant ID ${PrivateStoreId}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String] # Identifier for purposes of race condition ${ETag}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris]))] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris]))] [System.Collections.Hashtable] # Icon File Uris ${IconFileUri}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan[]] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[]] # Offer plans # To construct, see NOTES section for PLAN properties and create a hash table. ${Plan}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.String[]] # Plan ids limitation for this offer ${SpecificPlanIdLimitation}, - [Parameter()] + [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] [System.Management.Automation.SwitchParameter] # Indicating whether the offer was not updated to db (true = not updated). # If the allow list is identical to the existed one in db, the offer would not be updated. ${UpdateSuppressedDueIdempotence}, + [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Path of Json file supplied to the Update operation + ${JsonFilePath}, + + [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Json string supplied to the Update operation + ${JsonString}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -151,16 +160,41 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + $mapping = @{ UpdateExpanded = 'Az.Marketplace.private\Set-AzMarketplacePrivateStoreCollectionOffer_UpdateExpanded'; + UpdateViaJsonFilePath = 'Az.Marketplace.private\Set-AzMarketplacePrivateStoreCollectionOffer_UpdateViaJsonFilePath'; + UpdateViaJsonString = 'Az.Marketplace.private\Set-AzMarketplacePrivateStoreCollectionOffer_UpdateViaJsonString'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } } @@ -169,15 +203,32 @@ process { try { $steppablePipeline.Process($_) } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} end { try { $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/exports/Test-AzMarketplacePrivateStoreAnyExistingOffer.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Test-AzMarketplacePrivateStoreAnyExistingOffer.ps1 new file mode 100644 index 000000000000..6b27d313a0f8 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/exports/Test-AzMarketplacePrivateStoreAnyExistingOffer.ps1 @@ -0,0 +1,187 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Query whether exists any offer in the collections. +.Description +Query whether exists any offer in the collections. +.Example +Test-AzMarketplacePrivateStoreAnyExistingOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/test-azmarketplaceprivatestoreanyexistingoffer +#> +function Test-AzMarketplacePrivateStoreAnyExistingOffer { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse])] +[CmdletBinding(DefaultParameterSetName='Any', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Any', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='AnyViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + Any = 'Az.Marketplace.private\Test-AzMarketplacePrivateStoreAnyExistingOffer_Any'; + AnyViaIdentity = 'Az.Marketplace.private\Test-AzMarketplacePrivateStoreAnyExistingOffer_AnyViaIdentity'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Marketplace/Marketplace.Autorest/exports/Update-AzMarketplacePrivateStoreCollection.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Update-AzMarketplacePrivateStoreCollection.ps1 new file mode 100644 index 000000000000..75a68fc4866b --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/exports/Update-AzMarketplacePrivateStoreCollection.ps1 @@ -0,0 +1,272 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create private store collection +.Description +Create private store collection +.Example +Update-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId 8c7a91db-cd41-43b6-af47-2e869654126d -Enabled + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +PAYLOAD : The Collection data structure. + [AllSubscription ]: Indicating whether all subscriptions are selected (=true) or not (=false). + [Claim ]: Gets or sets the association with Commercial's Billing Account. + [CollectionName ]: Gets or sets collection name. + [Enabled ]: Indicating whether the collection is enabled or disabled. + [SubscriptionsList >]: Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/update-azmarketplaceprivatestorecollection +#> +function Update-AzMarketplacePrivateStoreCollection { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStore', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The collection ID + ${CollectionId}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicating whether all subscriptions are selected (=true) or not (=false). + ${AllSubscription}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Gets or sets the association with Commercial's Billing Account. + ${Claim}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Gets or sets collection name. + ${CollectionName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicating whether the collection is enabled or disabled. + ${Enabled}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String[]] + # Gets or sets subscription ids list. + # Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. + # On insert, null is considered as bad request + ${SubscriptionsList}, + + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection] + # The Collection data structure. + # To construct, see NOTES section for PAYLOAD properties and create a hash table. + ${Payload}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollection_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollection_UpdateViaIdentityExpanded'; + UpdateViaIdentityPrivateStore = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollection_UpdateViaIdentityPrivateStore'; + UpdateViaIdentityPrivateStoreExpanded = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollection_UpdateViaIdentityPrivateStoreExpanded'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Marketplace/Marketplace.Autorest/exports/Update-AzMarketplacePrivateStoreCollectionOffer.ps1 b/src/Marketplace/Marketplace.Autorest/exports/Update-AzMarketplacePrivateStoreCollectionOffer.ps1 new file mode 100644 index 000000000000..91532d33f6eb --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/exports/Update-AzMarketplacePrivateStoreCollectionOffer.ps1 @@ -0,0 +1,313 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update or add an offer to a specific collection of the private store. +.Description +Update or add an offer to a specific collection of the private store. +.Example +Update-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId 8c7a91db-cd41-43b6-af47-2e869654126d -OfferId "aumatics.azure_managedservices" -SpecificPlanIdLimitation $null + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +COLLECTIONINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +INPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update + +PAYLOAD : The privateStore offer data structure. + [ETag ]: Identifier for purposes of race condition + [IconFileUri ]: Icon File Uris + [(Any) ]: This indicates any property can be added to this object. + [Plan >]: Offer plans + [Accessibility ]: Plan accessibility + [SpecificPlanIdsLimitation >]: Plan ids limitation for this offer + [UpdateSuppressedDueIdempotence ]: Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated. + +PLAN : Offer plans + [Accessibility ]: Plan accessibility + +PRIVATESTOREINPUTOBJECT : Identity Parameter + [AdminRequestApprovalId ]: The admin request approval ID to get create or update + [CollectionId ]: The collection ID + [Id ]: Resource identity path + [OfferId ]: The offer ID to update or delete + [PrivateStoreId ]: The store ID - must use the tenant ID + [RequestApprovalId ]: The request approval ID to get create or update +.Link +https://learn.microsoft.com/powershell/module/az.marketplace/update-azmarketplaceprivatestorecollectionoffer +#> +function Update-AzMarketplacePrivateStoreCollectionOffer { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStore', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The collection ID + ${CollectionId}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityCollection', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityCollectionExpanded', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStore', Mandatory)] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The offer ID to update or delete + ${OfferId}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [System.String] + # The store ID - must use the tenant ID + ${PrivateStoreId}, + + [Parameter(ParameterSetName='UpdateViaIdentityCollection', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UpdateViaIdentityCollectionExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + ${CollectionInputObject}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity] + # Identity Parameter + # To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + ${PrivateStoreInputObject}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String] + # Identifier for purposes of race condition + ${ETag}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris]))] + [System.Collections.Hashtable] + # Icon File Uris + ${IconFileUri}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[]] + # Offer plans + # To construct, see NOTES section for PLAN properties and create a hash table. + ${Plan}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] + [AllowEmptyCollection()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.String[]] + # Plan ids limitation for this offer + ${SpecificPlanIdLimitation}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityCollectionExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStoreExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicating whether the offer was not updated to db (true = not updated). + # If the allow list is identical to the existed one in db, the offer would not be updated. + ${UpdateSuppressedDueIdempotence}, + + [Parameter(ParameterSetName='UpdateViaIdentityCollection', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='UpdateViaIdentityPrivateStore', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer] + # The privateStore offer data structure. + # To construct, see NOTES section for PAYLOAD properties and create a hash table. + ${Payload}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) + } else { + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + if ($internalCalledCmdlets -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name + } else { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' + } + + $mapping = @{ + UpdateExpanded = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollectionOffer_UpdateExpanded'; + UpdateViaIdentityCollection = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityCollection'; + UpdateViaIdentityCollectionExpanded = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityCollectionExpanded'; + UpdateViaIdentityExpanded = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityExpanded'; + UpdateViaIdentityPrivateStore = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityPrivateStore'; + UpdateViaIdentityPrivateStoreExpanded = 'Az.Marketplace.private\Update-AzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityPrivateStoreExpanded'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } + + finally { + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + +} +end { + try { + $steppablePipeline.End() + + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets + if ($preTelemetryId -eq '') { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + } + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId + + } catch { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() + throw + } +} +} diff --git a/src/Marketplace/Marketplace.Autorest/generate-help.ps1 b/src/Marketplace/Marketplace.Autorest/generate-help.ps1 index 4139e3e0e7af..4d06ded06d93 100644 --- a/src/Marketplace/Marketplace.Autorest/generate-help.ps1 +++ b/src/Marketplace/Marketplace.Autorest/generate-help.ps1 @@ -12,13 +12,13 @@ # Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code # is regenerated. # ---------------------------------------------------------------------------------- -param([switch]$Isolated) +param([switch]$NotIsolated) $ErrorActionPreference = 'Stop' $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path -if(-not $Isolated) { +if(-not $NotIsolated) { Write-Host -ForegroundColor Green 'Creating isolated process...' - & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated return } @@ -66,8 +66,8 @@ foreach($directory in $directories) $docsPath = Join-Path $docsFolder $directory.Name $null = New-Item -ItemType Directory -Force -Path $docsPath -ErrorAction SilentlyContinue $examplesPath = Join-Path $examplesFolder $directory.Name - - Export-HelpMarkdown -ModuleInfo $moduleInfo -FunctionInfo $cmdletFunctionInfo -HelpInfo $cmdletHelpInfo -DocsFolder $docsPath -ExamplesFolder $examplesPath + $addComplexInterfaceInfo = ![System.Convert]::ToBoolean('true') + Export-HelpMarkdown -ModuleInfo $moduleInfo -FunctionInfo $cmdletFunctionInfo -HelpInfo $cmdletHelpInfo -DocsFolder $docsPath -ExamplesFolder $examplesPath -AddComplexInterfaceInfo:$addComplexInterfaceInfo Write-Host -ForegroundColor Green "Created documentation in '$docsPath'" } diff --git a/src/Marketplace/Marketplace.Autorest/generate-portal-ux.ps1 b/src/Marketplace/Marketplace.Autorest/generate-portal-ux.ps1 new file mode 100644 index 000000000000..8d7993ad784e --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generate-portal-ux.ps1 @@ -0,0 +1,374 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# +# This Script will create a folder dedicated to Azure-specific content and includes metadata files essential for enhancing the user experience (UX) within the Azure portal. +# These files are utilized by the Azure portal to effectively present the usage of cmdlets related to specific resources on portal pages. +# ---------------------------------------------------------------------------------- +param([switch]$NotIsolated) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $NotIsolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated + return +} + +$moduleName = 'Az.Marketplace' +$rootModuleName = '' +if ($rootModuleName -eq "") +{ + $rootModuleName = $moduleName +} +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot "./$moduleName.psd1") +$modulePath = $modulePsd1.FullName + +# Load DLL to use build-time cmdlets +Import-Module -Name $modulePath +Import-Module -Name (Join-Path $PSScriptRoot "./bin/$moduleName.private.dll") +$instance = [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module]::Instance +# Module info is shared per profile +$moduleInfo = Get-Module -Name $moduleName +$parameterSetsInfo = Get-Module -Name "$moduleName.private" + +function Test-FunctionSupported() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [string] + $FunctionName + ) + + If (-not $FunctionName.Contains("_")) { + return $false + } + + $cmdletName, $parameterSetName = $FunctionName.Split("_") + If ($parameterSetName.Contains("List") -or $parameterSetName.Contains("ViaIdentity") -or $parameterSetName.Contains("ViaJson")) { + return $false + } + If ($cmdletName.StartsWith("New") -or $cmdletName.StartsWith("Set") -or $cmdletName.StartsWith("Update")) { + return $false + } + + $parameterSetInfo = $parameterSetsInfo.ExportedCmdlets[$FunctionName] + foreach ($parameterInfo in $parameterSetInfo.Parameters.Values) + { + $category = (Get-ParameterAttribute -ParameterInfo $parameterInfo -AttributeName "CategoryAttribute").Categories + $invalideCategory = @('Query', 'Body') + if ($invalideCategory -contains $category) + { + return $false + } + } + + $customFiles = Get-ChildItem -Path custom -Filter "$cmdletName.*" + if ($customFiles.Length -ne 0) + { + Write-Host -ForegroundColor Yellow "There are come custom files for $cmdletName, skip generate UX data for it." + return $false + } + + return $true +} + +function Get-MappedCmdletFromFunctionName() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [string] + $FunctionName + ) + + $cmdletName, $parameterSetName = $FunctionName.Split("_") + + return $cmdletName +} + +function Get-ParameterAttribute() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.ParameterMetadata] + $ParameterInfo, + [Parameter()] + [String] + $AttributeName + ) + return $ParameterInfo.Attributes | Where-Object { $_.TypeId.Name -eq $AttributeName } +} + +function Get-CmdletAttribute() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $CmdletInfo, + [Parameter()] + [String] + $AttributeName + ) + + return $CmdletInfo.ImplementingType.GetTypeInfo().GetCustomAttributes([System.object], $true) | Where-Object { $_.TypeId.Name -eq $AttributeName } +} + +function Get-CmdletDescription() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [String] + $CmdletName + ) + $helpInfo = Get-Help $CmdletName -Full + + $description = $helpInfo.Description.Text + if ($null -eq $description) + { + return "" + } + return $description +} + +# Test whether the parameter is from swagger http path +function Test-ParameterFromSwagger() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.ParameterMetadata] + $ParameterInfo + ) + $category = (Get-ParameterAttribute -ParameterInfo $ParameterInfo -AttributeName "CategoryAttribute").Categories + $doNotExport = Get-ParameterAttribute -ParameterInfo $ParameterInfo -AttributeName "DoNotExportAttribute" + if ($null -ne $doNotExport) + { + return $false + } + + $valideCategory = @('Path') + if ($valideCategory -contains $category) + { + return $true + } + return $false +} + +function New-ExampleForParameterSet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $ParameterSetInfo + ) + $parameters = $ParameterSetInfo.Parameters.Values | Where-Object { Test-ParameterFromSwagger $_ } + $result = @() + foreach ($parameter in $parameters) + { + $category = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "CategoryAttribute").Categories + $sourceName = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "InfoAttribute").SerializedName + $name = $parameter.Name + $result += [ordered]@{ + name = "-$Name" + value = "[$category.$sourceName]" + } + } + + return $result +} + +function New-ParameterArrayInParameterSet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $ParameterSetInfo + ) + $parameters = $ParameterSetInfo.Parameters.Values | Where-Object { Test-ParameterFromSwagger $_ } + $result = @() + foreach ($parameter in $parameters) + { + $isMandatory = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "ParameterAttribute").Mandatory + $parameterName = $parameter.Name + $parameterType = $parameter.ParameterType.ToString().Split('.')[1] + if ($parameter.SwitchParameter) + { + $parameterSignature = "-$parameterName" + } + else + { + $parameterSignature = "-$parameterName <$parameterType>" + } + if ($parameterName -eq "SubscriptionId") + { + $isMandatory = $false + } + if (-not $isMandatory) + { + $parameterSignature = "[$parameterSignature]" + } + $result += $parameterSignature + } + + return $result +} + +function New-MetadataForParameterSet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $ParameterSetInfo + ) + $httpAttribute = Get-CmdletAttribute -CmdletInfo $ParameterSetInfo -AttributeName "HttpPathAttribute" + $httpPath = $httpAttribute.Path + $apiVersion = $httpAttribute.ApiVersion + $provider = [System.Text.RegularExpressions.Regex]::New("/providers/([\w+\.]+)/").Match($httpPath).Groups[1].Value + $resourcePath = "/" + $httpPath.Split("$provider/")[1] + $resourceType = [System.Text.RegularExpressions.Regex]::New("/([\w]+)/\{\w+\}").Matches($resourcePath) | ForEach-Object {$_.groups[1].Value} | Join-String -Separator "/" + $cmdletName = Get-MappedCmdletFromFunctionName $ParameterSetInfo.Name + $description = (Get-CmdletAttribute -CmdletInfo $ParameterSetInfo -AttributeName "DescriptionAttribute").Description + [object[]]$example = New-ExampleForParameterSet $ParameterSetInfo + [string[]]$signature = New-ParameterArrayInParameterSet $ParameterSetInfo + + return @{ + Path = $httpPath + Provider = $provider + ResourceType = $resourceType + ApiVersion = $apiVersion + CmdletName = $cmdletName + Description = $description + Example = $example + Signature = @{ + parameters = $signature + } + } +} + +function Merge-WithExistCmdletMetadata() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Collections.Specialized.OrderedDictionary] + $ExistedCmdletInfo, + [Parameter()] + [Hashtable] + $ParameterSetMetadata + ) + $ExistedCmdletInfo.help.parameterSets += $ParameterSetMetadata.Signature + $ExistedCmdletInfo.examples += [ordered]@{ + description = $ParameterSetMetadata.Description + parameters = $ParameterSetMetadata.Example + } + + return $ExistedCmdletInfo +} + +function New-MetadataForCmdlet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [Hashtable] + $ParameterSetMetadata + ) + $cmdletName = $ParameterSetMetadata.CmdletName + $description = Get-CmdletDescription $cmdletName + $result = [ordered]@{ + name = $cmdletName + description = $description + path = $ParameterSetMetadata.Path + help = [ordered]@{ + learnMore = [ordered]@{ + url = "https://learn.microsoft.com/powershell/module/$rootModuleName/$cmdletName".ToLower() + } + parameterSets = @() + } + examples = @() + } + $result = Merge-WithExistCmdletMetadata -ExistedCmdletInfo $result -ParameterSetMetadata $ParameterSetMetadata + return $result +} + +$parameterSets = $parameterSetsInfo.ExportedCmdlets.Keys | Where-Object { Test-FunctionSupported($_) } +$resourceTypes = @{} +foreach ($parameterSetName in $parameterSets) +{ + $cmdletInfo = $parameterSetsInfo.ExportedCommands[$parameterSetName] + $parameterSetMetadata = New-MetadataForParameterSet -ParameterSetInfo $cmdletInfo + $cmdletName = $parameterSetMetadata.CmdletName + if (-not ($moduleInfo.ExportedCommands.ContainsKey($cmdletName))) + { + continue + } + if ($resourceTypes.ContainsKey($parameterSetMetadata.ResourceType)) + { + $ExistedCmdletInfo = $resourceTypes[$parameterSetMetadata.ResourceType].commands | Where-Object { $_.name -eq $cmdletName } + if ($ExistedCmdletInfo) + { + $ExistedCmdletInfo = Merge-WithExistCmdletMetadata -ExistedCmdletInfo $ExistedCmdletInfo -ParameterSetMetadata $parameterSetMetadata + } + else + { + $cmdletInfo = New-MetadataForCmdlet -ParameterSetMetadata $parameterSetMetadata + $resourceTypes[$parameterSetMetadata.ResourceType].commands += $cmdletInfo + } + } + else + { + $cmdletInfo = New-MetadataForCmdlet -ParameterSetMetadata $parameterSetMetadata + $resourceTypes[$parameterSetMetadata.ResourceType] = [ordered]@{ + resourceType = $parameterSetMetadata.ResourceType + apiVersion = $parameterSetMetadata.ApiVersion + learnMore = @{ + url = "https://learn.microsoft.com/powershell/module/$rootModuleName".ToLower() + } + commands = @($cmdletInfo) + provider = $parameterSetMetadata.Provider + } + } +} + +$UXFolder = 'UX' +if (Test-Path $UXFolder) +{ + Remove-Item -Path $UXFolder -Recurse +} +$null = New-Item -ItemType Directory -Path $UXFolder + +foreach ($resourceType in $resourceTypes.Keys) +{ + $resourceTypeFileName = $resourceType -replace "/", "-" + if ($resourceTypeFileName -eq "") + { + continue + } + $resourceTypeInfo = $resourceTypes[$resourceType] + $provider = $resourceTypeInfo.provider + $providerFolder = "$UXFolder/$provider" + if (-not (Test-Path $providerFolder)) + { + $null = New-Item -ItemType Directory -Path $providerFolder + } + $resourceTypeInfo.Remove("provider") + $resourceTypeInfo | ConvertTo-Json -Depth 10 | Out-File "$providerFolder/$resourceTypeFileName.json" +} diff --git a/src/Marketplace/Marketplace.Autorest/generated/Module.cs b/src/Marketplace/Marketplace.Autorest/generated/Module.cs index 0cfecdf45152..f136705d6c78 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/Module.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/Module.cs @@ -11,6 +11,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace using GetParameterDelegate = global::System.Func; using ModuleLoadPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; using ArgumentCompleterDelegate = global::System.Func; + using GetTelemetryIdDelegate = global::System.Func; + using TelemetryDelegate = global::System.Action; using NewRequestPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; using SignalDelegate = global::System.Func, global::System.Threading.Tasks.Task>; using EventListenerDelegate = global::System.Func, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Management.Automation.InvocationInfo, string, string, string, global::System.Exception, global::System.Threading.Tasks.Task>; @@ -24,12 +26,22 @@ public partial class Module public global::System.Net.Http.HttpClientHandler _handler = new global::System.Net.Http.HttpClientHandler(); + private static bool _init = false; + + private static readonly global::System.Object _initLock = new global::System.Object(); + + private static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module _instance; + /// the ISendAsync pipeline instance private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline _pipeline; /// the ISendAsync pipeline instance (when proxy is enabled) private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline _pipelineWithProxy; + private static readonly global::System.Object _singletonLock = new global::System.Object(); + + public bool _useProxy = false; + public global::System.Net.WebProxy _webProxy = new global::System.Net.WebProxy(); /// Gets completion data for azure specific fields @@ -44,11 +56,11 @@ public partial class Module /// The delegate to call to get parameter data from a common module. public GetParameterDelegate GetParameterValue { get; set; } - /// Backing field for property. - private static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module _instance; + /// The delegate to get the telemetry Id. + public GetTelemetryIdDelegate GetTelemetryId { get; set; } /// the singleton of this module class - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module Instance => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module._instance?? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module._instance = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module()); + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module Instance { get { if (_instance == null) { lock (_singletonLock) { if (_instance == null) { _instance = new Module(); }}} return _instance; } } /// The Name of this module public string Name => @"Az.Marketplace"; @@ -65,6 +77,9 @@ public partial class Module /// The ResourceID for this module (azure arm). public string ResourceId => @"Az.Marketplace"; + /// The delegate for creating a telemetry. + public TelemetryDelegate Telemetry { get; set; } + /// The from the cmdlet /// The HttpPipeline for the request @@ -88,7 +103,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Creat { Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline pipeline = null; BeforeCreatePipeline(invocationInfo, ref pipeline); - pipeline = (pipeline ?? (_handler.UseProxy ? _pipelineWithProxy : _pipeline)).Clone(); + pipeline = (pipeline ?? (_useProxy ? _pipelineWithProxy : _pipeline)).Clone(); AfterCreatePipeline(invocationInfo, ref pipeline); pipeline.Append(new Runtime.CmdInfoHandler(processRecordId, invocationInfo, parameterSetName).SendAsync); OnNewRequest?.Invoke( invocationInfo, correlationId,processRecordId, (step)=> { pipeline.Prepend(step); } , (step)=> { pipeline.Append(step); } ); @@ -107,15 +122,23 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Creat /// Initialization steps performed after the module is loaded. public void Init() { - OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipeline.Prepend(step); } , (step)=> { _pipeline.Append(step); } ); - OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipelineWithProxy.Prepend(step); } , (step)=> { _pipelineWithProxy.Append(step); } ); - CustomInit(); + if (_init == false) + { + lock (_initLock) { + if (_init == false) { + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipeline.Prepend(step); } , (step)=> { _pipeline.Append(step); } ); + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipelineWithProxy.Prepend(step); } , (step)=> { _pipelineWithProxy.Append(step); } ); + CustomInit(); + _init = true; + } + } + } } /// Creates the module instance. private Module() { - /// constructor + // constructor ClientAPI = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace(); _handler.Proxy = _webProxy; _pipeline = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient())); @@ -127,12 +150,24 @@ private Module() /// True if the proxy should use default credentials public void SetProxyConfiguration(global::System.Uri proxy, global::System.Management.Automation.PSCredential proxyCredential, bool proxyUseDefaultCredentials) { + _useProxy = proxy != null; + if (proxy == null) + { + return; + } // set the proxy configuration _webProxy.Address = proxy; _webProxy.BypassProxyOnLocal = false; - _webProxy.Credentials = proxyCredential ?.GetNetworkCredential(); - _webProxy.UseDefaultCredentials = proxyUseDefaultCredentials; - _handler.UseProxy = proxy != null; + if (proxyUseDefaultCredentials) + { + _webProxy.Credentials = null; + _webProxy.UseDefaultCredentials = true; + } + else + { + _webProxy.UseDefaultCredentials = false; + _webProxy.Credentials = proxyCredential ?.GetNetworkCredential(); + } } /// Called to dispatch events to the common module listener diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Marketplace.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Marketplace.cs index 3b907467a779..a8e905e59ca4 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Marketplace.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Marketplace.cs @@ -23,9 +23,9 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task OperationsList(global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task OperationsList(global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -45,7 +45,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + await this.OperationsList_Call (request, onOk,onDefault,eventListener,sender); } } @@ -59,9 +59,9 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task OperationsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task OperationsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -90,11 +90,147 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + await this.OperationsList_Call (request, onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Lists all of the available Microsoft.Marketplace REST API operations. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/operations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/operations'"); + } + + // replace URI parameters with values from identity + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.OperationsListWithResult_Call (request, eventListener,sender); + } + } + + /// Lists all of the available Microsoft.Marketplace REST API operations. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsListWithResult(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.OperationsListWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task OperationsListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OperationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -104,7 +240,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task OperationsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task OperationsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -115,6 +251,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -122,13 +259,13 @@ public partial class Marketplace case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OperationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OperationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -168,12 +305,13 @@ public partial class Marketplace /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreAcknowledgeOfferNotification(string privateStoreId, string offerId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationProperties body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreAcknowledgeOfferNotification(string privateStoreId, string offerId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationProperties body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -197,11 +335,11 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreAcknowledgeOfferNotification_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreAcknowledgeOfferNotification_Call (request, onOk,onDefault,eventListener,sender); } } @@ -213,21 +351,22 @@ public partial class Marketplace /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreAcknowledgeOfferNotificationViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationProperties body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreAcknowledgeOfferNotificationViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationProperties body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/offers/(?[^/]+)/acknowledgeNotification$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/offers/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/offers/{offerId}/acknowledgeNotification'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/offers/{offerId}'"); } // replace URI parameters with values from identity @@ -253,16 +392,62 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreAcknowledgeOfferNotification_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Acknowledge notification for offer + /// The store ID - must use the tenant ID + /// The offer ID to update or delete + /// Json string supplied to the PrivateStoreAcknowledgeOfferNotification operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreAcknowledgeOfferNotificationViaJsonString(string privateStoreId, string offerId, global::System.String jsonString, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/offers/" + + global::System.Uri.EscapeDataString(offerId) + + "/acknowledgeNotification" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreAcknowledgeOfferNotification_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreAcknowledgeOfferNotification_Call (request, onOk,onDefault,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -273,7 +458,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreAcknowledgeOfferNotification_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PrivateStoreAcknowledgeOfferNotification_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -284,6 +469,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -297,7 +483,7 @@ public partial class Marketplace default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -323,7 +509,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreAcknowledgeOfferNotification_Validate(string privateStoreId, string offerId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationProperties body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PrivateStoreAcknowledgeOfferNotification_Validate(string privateStoreId, string offerId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationProperties body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -344,9 +530,9 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreAdminRequestApprovalsList(string privateStoreId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreAdminRequestApprovalsList(string privateStoreId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -368,7 +554,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreAdminRequestApprovalsList_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreAdminRequestApprovalsList_Call (request, onOk,onDefault,eventListener,sender); } } @@ -382,9 +568,9 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreAdminRequestApprovalsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreAdminRequestApprovalsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -416,12 +602,156 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreAdminRequestApprovalsList_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreAdminRequestApprovalsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get list of admin request approvals + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreAdminRequestApprovalsListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/adminRequestApprovals$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/adminRequestApprovals'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/adminRequestApprovals" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreAdminRequestApprovalsListWithResult_Call (request, eventListener,sender); + } + } + + /// Get list of admin request approvals + /// The store ID - must use the tenant ID + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreAdminRequestApprovalsListWithResult(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/adminRequestApprovals" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreAdminRequestApprovalsListWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreAdminRequestApprovalsListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -432,7 +762,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreAdminRequestApprovalsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PrivateStoreAdminRequestApprovalsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -443,6 +773,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -450,13 +781,13 @@ public partial class Marketplace case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AdminRequestApprovalsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -488,7 +819,7 @@ public partial class Marketplace } } - /// Tenant billing accounts names + /// Query whether exists any offer in the collections. /// The store ID - must use the tenant ID /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -498,9 +829,9 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreBillingAccounts(string privateStoreId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreAnyExistingOffersInTheCollections(string privateStoreId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -508,7 +839,7 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + global::System.Uri.EscapeDataString(privateStoreId) - + "/billingAccounts" + + "/anyExistingOffersInTheCollections" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -522,11 +853,11 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreBillingAccounts_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreAnyExistingOffersInTheCollections_Call (request, onOk,onDefault,eventListener,sender); } } - /// Tenant billing accounts names + /// Query whether exists any offer in the collections. /// /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -536,18 +867,18 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreBillingAccountsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreAnyExistingOffersInTheCollectionsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/billingAccounts$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/billingAccounts'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); } // replace URI parameters with values from identity @@ -556,7 +887,7 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + privateStoreId - + "/billingAccounts" + + "/anyExistingOffersInTheCollections" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -570,31 +901,178 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreBillingAccounts_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreAnyExistingOffersInTheCollections_Call (request, onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. - /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// Query whether exists any offer in the collections. + /// /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreBillingAccounts_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreAnyExistingOffersInTheCollectionsViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { + var apiVersion = @"2023-01-01"; + // Constant Parameters using( NoSynchronizationContext ) { - global::System.Net.Http.HttpResponseMessage _response = null; - try - { - var sendTask = sender.SendAsync(request, eventListener); + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/anyExistingOffersInTheCollections" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreAnyExistingOffersInTheCollectionsWithResult_Call (request, eventListener,sender); + } + } + + /// Query whether exists any offer in the collections. + /// The store ID - must use the tenant ID + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreAnyExistingOffersInTheCollectionsWithResult(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/anyExistingOffersInTheCollections" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreAnyExistingOffersInTheCollectionsWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreAnyExistingOffersInTheCollectionsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AnyExistingOffersInTheCollectionsResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreAnyExistingOffersInTheCollections_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -602,13 +1080,13 @@ public partial class Marketplace case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.BillingAccountsResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AnyExistingOffersInTheCollectionsResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -624,15 +1102,15 @@ public partial class Marketplace } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. /// /// The store ID - must use the tenant ID /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreBillingAccounts_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PrivateStoreAnyExistingOffersInTheCollections_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -640,9 +1118,8 @@ public partial class Marketplace } } - /// Perform an action on bulk collections + /// Tenant billing accounts names /// The store ID - must use the tenant ID - /// Bulk collections action properties /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). @@ -651,9 +1128,9 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreBulkCollectionsAction(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreBillingAccounts(string privateStoreId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -661,7 +1138,7 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + global::System.Uri.EscapeDataString(privateStoreId) - + "/bulkCollectionsAction" + + "/billingAccounts" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -674,18 +1151,13 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); - request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreBulkCollectionsAction_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreBillingAccounts_Call (request, onOk,onDefault,eventListener,sender); } } - /// Perform an action on bulk collections + /// Tenant billing accounts names /// - /// Bulk collections action properties /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). @@ -694,18 +1166,18 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreBulkCollectionsActionViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreBillingAccountsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/bulkCollectionsAction$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/bulkCollectionsAction'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); } // replace URI parameters with values from identity @@ -714,7 +1186,7 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + privateStoreId - + "/bulkCollectionsAction" + + "/billingAccounts" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -727,16 +1199,156 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); - request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreBulkCollectionsAction_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreBillingAccounts_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Tenant billing accounts names + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreBillingAccountsViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/billingAccounts" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreBillingAccountsWithResult_Call (request, eventListener,sender); + } + } + + /// Tenant billing accounts names + /// The store ID - must use the tenant ID + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreBillingAccountsWithResult(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/billingAccounts" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreBillingAccountsWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreBillingAccountsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.BillingAccountsResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -746,7 +1358,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreBulkCollectionsAction_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PrivateStoreBillingAccounts_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -757,6 +1369,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -764,13 +1377,13 @@ public partial class Marketplace case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.BulkCollectionsResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.BillingAccountsResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -786,40 +1399,37 @@ public partial class Marketplace } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. /// /// The store ID - must use the tenant ID - /// Bulk collections action properties /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreBulkCollectionsAction_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PrivateStoreBillingAccounts_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Create or update private store collection + /// Perform an action on bulk collections /// The store ID - must use the tenant ID - /// The collection ID - /// The Collection data structure. + /// Bulk collections action properties /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionCreateOrUpdate(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreBulkCollectionsAction(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -827,8 +1437,7 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + global::System.Uri.EscapeDataString(privateStoreId) - + "/collections/" - + global::System.Uri.EscapeDataString(collectionId) + + "/bulkCollectionsAction" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -837,53 +1446,52 @@ public partial class Marketplace // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreCollectionCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreBulkCollectionsAction_Call (request, onOk,onDefault,eventListener,sender); } } - /// Create or update private store collection + /// Perform an action on bulk collections /// - /// The Collection data structure. + /// Bulk collections action properties /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreBulkCollectionsActionViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); } // replace URI parameters with values from identity var privateStoreId = _match.Groups["privateStoreId"].Value; - var collectionId = _match.Groups["collectionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + privateStoreId - + "/collections/" - + collectionId + + "/bulkCollectionsAction" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -892,107 +1500,126 @@ public partial class Marketplace // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreCollectionCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreBulkCollectionsAction_Call (request, onOk,onDefault,eventListener,sender); } } - /// - /// Actual wire call for method. - /// - /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// Perform an action on bulk collections + /// + /// Bulk collections action properties /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreBulkCollectionsActionViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { + var apiVersion = @"2023-01-01"; + // Constant Parameters using( NoSynchronizationContext ) { - global::System.Net.Http.HttpResponseMessage _response = null; - try - { - var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - var _contentType = _response.Content.Headers.ContentType?.MediaType; + // verify that Identity format is an exact match for uri - switch ( _response.StatusCode ) - { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Collection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/bulkCollectionsAction" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreBulkCollectionsActionWithResult_Call (request, eventListener,sender); } } - /// - /// Validation method for method. Call this like the actual call, but - /// you will get validation events back. - /// + /// Perform an action on bulk collections /// The store ID - must use the tenant ID - /// The collection ID - /// The Collection data structure. + /// Json string supplied to the PrivateStoreBulkCollectionsAction operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionCreateOrUpdate_Validate(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + public async global::System.Threading.Tasks.Task PrivateStoreBulkCollectionsActionViaJsonString(string privateStoreId, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { + var apiVersion = @"2023-01-01"; + // Constant Parameters using( NoSynchronizationContext ) { - await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); - await eventListener.AssertNotNull(nameof(collectionId),collectionId); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/bulkCollectionsAction" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreBulkCollectionsAction_Call (request, onOk,onDefault,eventListener,sender); } } - /// Delete a collection from the given private store. + /// Perform an action on bulk collections /// The store ID - must use the tenant ID - /// The collection ID - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 204 (NoContent). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// Json string supplied to the PrivateStoreBulkCollectionsAction operation /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionDelete(string privateStoreId, string collectionId, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreBulkCollectionsActionViaJsonStringWithResult(string privateStoreId, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1000,80 +1627,135 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + global::System.Uri.EscapeDataString(privateStoreId) - + "/collections/" - + global::System.Uri.EscapeDataString(collectionId) + + "/bulkCollectionsAction" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Delete, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.PrivateStoreCollectionDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + return await this.PrivateStoreBulkCollectionsActionWithResult_Call (request, eventListener,sender); } } - /// Delete a collection from the given private store. - /// - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 204 (NoContent). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// Perform an action on bulk collections + /// The store ID - must use the tenant ID + /// Bulk collections action properties /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreBulkCollectionsActionWithResult(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { - // verify that Identity format is an exact match for uri - - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}'"); - } - - // replace URI parameters with values from identity - var privateStoreId = _match.Groups["privateStoreId"].Value; - var collectionId = _match.Groups["collectionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" - + privateStoreId - + "/collections/" - + collectionId + + global::System.Uri.EscapeDataString(privateStoreId) + + "/bulkCollectionsAction" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Delete, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.PrivateStoreCollectionDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + return await this.PrivateStoreBulkCollectionsActionWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreBulkCollectionsActionWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.BulkCollectionsResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 204 (NoContent). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -1081,7 +1763,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PrivateStoreBulkCollectionsAction_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1092,6 +1774,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1099,19 +1782,13 @@ public partial class Marketplace case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response); - break; - } - case global::System.Net.HttpStatusCode.NoContent: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.BulkCollectionsResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -1127,25 +1804,26 @@ public partial class Marketplace } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. /// /// The store ID - must use the tenant ID - /// The collection ID + /// Bulk collections action properties /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionDelete_Validate(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PrivateStoreBulkCollectionsAction_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); - await eventListener.AssertNotNull(nameof(collectionId),collectionId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Gets private store collection + /// Delete all existing offers from the collection and enable approve all items. /// The store ID - must use the tenant ID /// The collection ID /// a delegate that is called when the remote service returns 200 (OK). @@ -1156,9 +1834,9 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionGet(string privateStoreId, string collectionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionApproveAllItems(string privateStoreId, string collectionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1168,6 +1846,7 @@ public partial class Marketplace + global::System.Uri.EscapeDataString(privateStoreId) + "/collections/" + global::System.Uri.EscapeDataString(collectionId) + + "/approveAllItems" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -1176,16 +1855,16 @@ public partial class Marketplace // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreCollectionGet_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreCollectionApproveAllItems_Call (request, onOk,onDefault,eventListener,sender); } } - /// Gets private store collection + /// Delete all existing offers from the collection and enable approve all items. /// /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -1195,9 +1874,9 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionApproveAllItemsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1218,6 +1897,7 @@ public partial class Marketplace + privateStoreId + "/collections/" + collectionId + + "/approveAllItems" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -1226,96 +1906,76 @@ public partial class Marketplace // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreCollectionGet_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreCollectionApproveAllItems_Call (request, onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. - /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// Delete all existing offers from the collection and enable approve all items. + /// /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A + /// that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionApproveAllItemsViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { + var apiVersion = @"2023-01-01"; + // Constant Parameters using( NoSynchronizationContext ) { - global::System.Net.Http.HttpResponseMessage _response = null; - try - { - var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - var _contentType = _response.Content.Headers.ContentType?.MediaType; + // verify that Identity format is an exact match for uri - switch ( _response.StatusCode ) - { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Collection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}'"); } - } - } - /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. - /// - /// The store ID - must use the tenant ID - /// The collection ID - /// an instance that will receive events. - /// - /// A that will be complete when handling of the response is completed. - /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionGet_Validate(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) - { - using( NoSynchronizationContext ) - { - await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); - await eventListener.AssertNotNull(nameof(collectionId),collectionId); + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var collectionId = _match.Groups["collectionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/collections/" + + collectionId + + "/approveAllItems" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionApproveAllItemsWithResult_Call (request, eventListener,sender); } } - /// Gets private store collections list + /// Delete all existing offers from the collection and enable approve all items. /// The store ID - must use the tenant ID - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// The collection ID /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A + /// that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionList(string privateStoreId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionApproveAllItemsWithResult(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1323,73 +1983,91 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + global::System.Uri.EscapeDataString(privateStoreId) - + "/collections" + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/approveAllItems" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.PrivateStoreCollectionList_Call(request,onOk,onDefault,eventListener,sender); + return await this.PrivateStoreCollectionApproveAllItemsWithResult_Call (request, eventListener,sender); } } - /// Gets private store collections list - /// - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A + /// that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionApproveAllItemsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; - // Constant Parameters using( NoSynchronizationContext ) { - // verify that Identity format is an exact match for uri + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Collection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections'"); + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); } - - // replace URI parameters with values from identity - var privateStoreId = _match.Groups["privateStoreId"].Value; - // construct URL - var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.Marketplace/privateStores/" - + privateStoreId - + "/collections" - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.PrivateStoreCollectionList_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// + /// Actual wire call for method. + /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -1399,7 +2077,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionApproveAllItems_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1410,6 +2088,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1417,13 +2096,13 @@ public partial class Marketplace case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Collection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -1439,38 +2118,40 @@ public partial class Marketplace } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. /// /// The store ID - must use the tenant ID + /// The collection ID /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionList_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionApproveAllItems_Validate(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(collectionId),collectionId); } } - /// Update or add an offer to a specific collection of the private store. + /// Create private store collection /// The store ID - must use the tenant ID - /// The offer ID to update or delete /// The collection ID - /// The privateStore offer data structure. + /// The Collection data structure. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferCreateOrUpdate(string privateStoreId, string offerId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionCreateOrUpdate(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1480,8 +2161,6 @@ public partial class Marketplace + global::System.Uri.EscapeDataString(privateStoreId) + "/collections/" + global::System.Uri.EscapeDataString(collectionId) - + "/offers/" - + global::System.Uri.EscapeDataString(offerId) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -1495,42 +2174,42 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreCollectionOfferCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreCollectionCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); } } - /// Update or add an offer to a specific collection of the private store. + /// Create private store collection /// - /// The privateStore offer data structure. + /// The Collection data structure. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)/offers/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}'"); } // replace URI parameters with values from identity var privateStoreId = _match.Groups["privateStoreId"].Value; - var offerId = _match.Groups["offerId"].Value; var collectionId = _match.Groups["collectionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( @@ -1538,8 +2217,6 @@ public partial class Marketplace + privateStoreId + "/collections/" + collectionId - + "/offers/" - + offerId + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -1553,95 +2230,73 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreCollectionOfferCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreCollectionCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); } } - /// - /// Actual wire call for method. - /// - /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// Create private store collection + /// + /// The Collection data structure. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// - /// A that will be complete when handling of the response is completed. + /// A + /// that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionCreateOrUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { + var apiVersion = @"2023-01-01"; + // Constant Parameters using( NoSynchronizationContext ) { - global::System.Net.Http.HttpResponseMessage _response = null; - try - { - var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - var _contentType = _response.Content.Headers.ContentType?.MediaType; + // verify that Identity format is an exact match for uri - switch ( _response.StatusCode ) - { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Offer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}'"); } - } - } - /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. - /// - /// The store ID - must use the tenant ID - /// The offer ID to update or delete - /// The collection ID - /// The privateStore offer data structure. - /// an instance that will receive events. - /// - /// A that will be complete when handling of the response is completed. - /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferCreateOrUpdate_Validate(string privateStoreId, string offerId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) - { - using( NoSynchronizationContext ) - { - await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); - await eventListener.AssertNotNull(nameof(offerId),offerId); - await eventListener.AssertNotNull(nameof(collectionId),collectionId); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var collectionId = _match.Groups["collectionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/collections/" + + collectionId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionCreateOrUpdateWithResult_Call (request, eventListener,sender); } } - /// Deletes an offer from the given collection of private store. + /// Create private store collection /// The store ID - must use the tenant ID - /// The offer ID to update or delete /// The collection ID + /// Json string supplied to the PrivateStoreCollectionCreateOrUpdate operation /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 204 (NoContent). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -1649,9 +2304,9 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferDelete(string privateStoreId, string offerId, string collectionId, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionCreateOrUpdateViaJsonString(string privateStoreId, string collectionId, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1661,8 +2316,6 @@ public partial class Marketplace + global::System.Uri.EscapeDataString(privateStoreId) + "/collections/" + global::System.Uri.EscapeDataString(collectionId) - + "/offers/" - + global::System.Uri.EscapeDataString(offerId) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -1671,73 +2324,173 @@ public partial class Marketplace // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreCollectionOfferDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + await this.PrivateStoreCollectionCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); } } - /// Deletes an offer from the given collection of private store. - /// - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 204 (NoContent). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// Create private store collection + /// The store ID - must use the tenant ID + /// The collection ID + /// Json string supplied to the PrivateStoreCollectionCreateOrUpdate operation /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A + /// that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionCreateOrUpdateViaJsonStringWithResult(string privateStoreId, string collectionId, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { - // verify that Identity format is an exact match for uri - - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)/offers/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}'"); - } - - // replace URI parameters with values from identity - var privateStoreId = _match.Groups["privateStoreId"].Value; - var offerId = _match.Groups["offerId"].Value; - var collectionId = _match.Groups["collectionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" - + privateStoreId + + global::System.Uri.EscapeDataString(privateStoreId) + "/collections/" - + collectionId - + "/offers/" - + offerId + + global::System.Uri.EscapeDataString(collectionId) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Delete, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Create private store collection + /// The store ID - must use the tenant ID + /// The collection ID + /// The Collection data structure. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A + /// that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionCreateOrUpdateWithResult(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.PrivateStoreCollectionOfferDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + return await this.PrivateStoreCollectionCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionCreateOrUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Collection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } } } - /// Actual wire call for method. + /// + /// Actual wire call for method. + /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 204 (NoContent). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -1745,7 +2498,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1756,6 +2509,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1763,19 +2517,13 @@ public partial class Marketplace case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response); - break; - } - case global::System.Net.HttpStatusCode.NoContent: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Collection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -1791,31 +2539,32 @@ public partial class Marketplace } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. /// /// The store ID - must use the tenant ID - /// The offer ID to update or delete /// The collection ID + /// The Collection data structure. /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferDelete_Validate(string privateStoreId, string offerId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionCreateOrUpdate_Validate(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); - await eventListener.AssertNotNull(nameof(offerId),offerId); await eventListener.AssertNotNull(nameof(collectionId),collectionId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Gets information about a specific offer. + /// Delete a collection from the given private store. /// The store ID - must use the tenant ID - /// The offer ID to update or delete /// The collection ID /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -1823,9 +2572,9 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferGet(string privateStoreId, string offerId, string collectionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionDelete(string privateStoreId, string collectionId, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1835,8 +2584,6 @@ public partial class Marketplace + global::System.Uri.EscapeDataString(privateStoreId) + "/collections/" + global::System.Uri.EscapeDataString(collectionId) - + "/offers/" - + global::System.Uri.EscapeDataString(offerId) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -1845,18 +2592,19 @@ public partial class Marketplace // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreCollectionOfferGet_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreCollectionDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); } } - /// Gets information about a specific offer. + /// Delete a collection from the given private store. /// /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -1864,23 +2612,22 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)/offers/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}'"); } // replace URI parameters with values from identity var privateStoreId = _match.Groups["privateStoreId"].Value; - var offerId = _match.Groups["offerId"].Value; var collectionId = _match.Groups["collectionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( @@ -1888,8 +2635,6 @@ public partial class Marketplace + privateStoreId + "/collections/" + collectionId - + "/offers/" - + offerId + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -1898,18 +2643,19 @@ public partial class Marketplace // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreCollectionOfferGet_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreCollectionDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. @@ -1917,7 +2663,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1928,6 +2674,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1935,13 +2682,19 @@ public partial class Marketplace case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Offer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -1957,27 +2710,25 @@ public partial class Marketplace } /// - /// Validation method for method. Call this like the actual call, but you will + /// Validation method for method. Call this like the actual call, but you will /// get validation events back. /// /// The store ID - must use the tenant ID - /// The offer ID to update or delete /// The collection ID /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferGet_Validate(string privateStoreId, string offerId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionDelete_Validate(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); - await eventListener.AssertNotNull(nameof(offerId),offerId); await eventListener.AssertNotNull(nameof(collectionId),collectionId); } } - /// Get a list of all private offers in the given private store and collection + /// Disable approve all items for the collection. /// The store ID - must use the tenant ID /// The collection ID /// a delegate that is called when the remote service returns 200 (OK). @@ -1988,9 +2739,9 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferList(string privateStoreId, string collectionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionDisableApproveAllItems(string privateStoreId, string collectionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2000,7 +2751,7 @@ public partial class Marketplace + global::System.Uri.EscapeDataString(privateStoreId) + "/collections/" + global::System.Uri.EscapeDataString(collectionId) - + "/offers" + + "/disableApproveAllItems" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -2009,16 +2760,16 @@ public partial class Marketplace // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreCollectionOfferList_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreCollectionDisableApproveAllItems_Call (request, onOk,onDefault,eventListener,sender); } } - /// Get a list of all private offers in the given private store and collection + /// Disable approve all items for the collection. /// /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -2028,18 +2779,18 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionDisableApproveAllItemsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)/offers$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}'"); } // replace URI parameters with values from identity @@ -2051,7 +2802,7 @@ public partial class Marketplace + privateStoreId + "/collections/" + collectionId - + "/offers" + + "/disableApproveAllItems" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -2060,16 +2811,168 @@ public partial class Marketplace // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreCollectionOfferList_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreCollectionDisableApproveAllItems_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Disable approve all items for the collection. + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionDisableApproveAllItemsViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var collectionId = _match.Groups["collectionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/collections/" + + collectionId + + "/disableApproveAllItems" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionDisableApproveAllItemsWithResult_Call (request, eventListener,sender); + } + } + + /// Disable approve all items for the collection. + /// The store ID - must use the tenant ID + /// The collection ID + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionDisableApproveAllItemsWithResult(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/disableApproveAllItems" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionDisableApproveAllItemsWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A + /// that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionDisableApproveAllItemsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Collection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } } } - /// Actual wire call for method. + /// + /// Actual wire call for method. + /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -2079,7 +2982,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionDisableApproveAllItems_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -2090,6 +2993,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -2097,13 +3001,13 @@ public partial class Marketplace case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Collection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -2119,8 +3023,8 @@ public partial class Marketplace } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. /// /// The store ID - must use the tenant ID /// The collection ID @@ -2128,7 +3032,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferList_Validate(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionDisableApproveAllItems_Validate(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -2137,11 +3041,9 @@ public partial class Marketplace } } - /// Delete Private store offer. This is a workaround. + /// Gets private store collection /// The store ID - must use the tenant ID - /// The offer ID to update or delete /// The collection ID - /// Set the Operation for the POST method. Ping or Delete /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). @@ -2150,9 +3052,9 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferPost(string privateStoreId, string offerId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Operation? body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionGet(string privateStoreId, string collectionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2162,8 +3064,6 @@ public partial class Marketplace + global::System.Uri.EscapeDataString(privateStoreId) + "/collections/" + global::System.Uri.EscapeDataString(collectionId) - + "/offers/" - + global::System.Uri.EscapeDataString(offerId) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -2172,22 +3072,17 @@ public partial class Marketplace // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // set body content - request.Content = null /* serializeToContent doesn't support 'application/json' C:\Users\yunwang\.autorest\@autorest_powershell@3.0.463\node_modules\@autorest\powershell\dist\llcsharp\schema\string.js*/; - request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreCollectionOfferPost_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreCollectionGet_Call (request, onOk,onDefault,eventListener,sender); } } - /// Delete Private store offer. This is a workaround. + /// Gets private store collection /// - /// Set the Operation for the POST method. Ping or Delete /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). @@ -2196,23 +3091,22 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferPostViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Operation? body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)/offers/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}'"); } // replace URI parameters with values from identity var privateStoreId = _match.Groups["privateStoreId"].Value; - var offerId = _match.Groups["offerId"].Value; var collectionId = _match.Groups["collectionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( @@ -2220,8 +3114,6 @@ public partial class Marketplace + privateStoreId + "/collections/" + collectionId - + "/offers/" - + offerId + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -2230,107 +3122,75 @@ public partial class Marketplace // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // set body content - request.Content = null /* serializeToContent doesn't support 'application/json' C:\Users\yunwang\.autorest\@autorest_powershell@3.0.463\node_modules\@autorest\powershell\dist\llcsharp\schema\string.js*/; - request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreCollectionOfferPost_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreCollectionGet_Call (request, onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. - /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// Gets private store collection + /// /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A + /// that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferPost_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { + var apiVersion = @"2023-01-01"; + // Constant Parameters using( NoSynchronizationContext ) { - global::System.Net.Http.HttpResponseMessage _response = null; - try - { - var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - var _contentType = _response.Content.Headers.ContentType?.MediaType; + // verify that Identity format is an exact match for uri - switch ( _response.StatusCode ) - { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}'"); } - } - } - /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. - /// - /// The store ID - must use the tenant ID - /// The offer ID to update or delete - /// The collection ID - /// Set the Operation for the POST method. Ping or Delete - /// an instance that will receive events. - /// - /// A that will be complete when handling of the response is completed. - /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferPost_Validate(string privateStoreId, string offerId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Operation? body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) - { - using( NoSynchronizationContext ) - { - await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); - await eventListener.AssertNotNull(nameof(offerId),offerId); - await eventListener.AssertNotNull(nameof(collectionId),collectionId); - await eventListener.AssertNotNull(nameof(body),body); - await eventListener.AssertEnum(nameof(body),body,@"DeletePrivateStoreOffer", @"DeletePrivateStoreCollection", @"DeletePrivateStoreCollectionOffer", @"Ping"); + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var collectionId = _match.Groups["collectionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/collections/" + + collectionId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionGetWithResult_Call (request, eventListener,sender); } } - /// Delete Private store collection. This is a workaround. + /// Gets private store collection /// The store ID - must use the tenant ID /// The collection ID - /// Set the Operation for the POST method. Ping or Delete - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A + /// that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionPost(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Operation? body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionGetWithResult(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2344,79 +3204,82 @@ public partial class Marketplace + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // set body content - request.Content = null /* serializeToContent doesn't support 'application/json' C:\Users\yunwang\.autorest\@autorest_powershell@3.0.463\node_modules\@autorest\powershell\dist\llcsharp\schema\string.js*/; - request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.PrivateStoreCollectionPost_Call(request,onOk,onDefault,eventListener,sender); + return await this.PrivateStoreCollectionGetWithResult_Call (request, eventListener,sender); } } - /// Delete Private store collection. This is a workaround. - /// - /// Set the Operation for the POST method. Ping or Delete - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A + /// that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionPostViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Operation? body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; - // Constant Parameters using( NoSynchronizationContext ) { - // verify that Identity format is an exact match for uri + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Collection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}'"); + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); } - - // replace URI parameters with values from identity - var privateStoreId = _match.Groups["privateStoreId"].Value; - var collectionId = _match.Groups["collectionId"].Value; - // construct URL - var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.Marketplace/privateStores/" - + privateStoreId - + "/collections/" - + collectionId - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // set body content - request.Content = null /* serializeToContent doesn't support 'application/json' C:\Users\yunwang\.autorest\@autorest_powershell@3.0.463\node_modules\@autorest\powershell\dist\llcsharp\schema\string.js*/; - request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.PrivateStoreCollectionPost_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -2426,7 +3289,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionPost_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -2437,6 +3300,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -2444,13 +3308,13 @@ public partial class Marketplace case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Collection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -2466,33 +3330,26 @@ public partial class Marketplace } /// - /// Validation method for method. Call this like the actual call, but you will get + /// Validation method for method. Call this like the actual call, but you will get /// validation events back. /// /// The store ID - must use the tenant ID /// The collection ID - /// Set the Operation for the POST method. Ping or Delete /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionPost_Validate(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Operation? body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionGet_Validate(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); await eventListener.AssertNotNull(nameof(collectionId),collectionId); - await eventListener.AssertNotNull(nameof(body),body); - await eventListener.AssertEnum(nameof(body),body,@"DeletePrivateStoreOffer", @"DeletePrivateStoreCollection", @"DeletePrivateStoreCollectionOffer", @"Ping"); } } - /// - /// transferring offers (copy or move) from source collection to target collection(s) - /// + /// Gets private store collections list /// The store ID - must use the tenant ID - /// The collection ID - /// Transfer offers properties /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). @@ -2501,9 +3358,9 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionTransferOffers(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionList(string privateStoreId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2511,9 +3368,7 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + global::System.Uri.EscapeDataString(privateStoreId) - + "/collections/" - + global::System.Uri.EscapeDataString(collectionId) - + "/transferOffers" + + "/collections" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -2522,24 +3377,17 @@ public partial class Marketplace // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); - request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreCollectionTransferOffers_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreCollectionList_Call (request, onOk,onDefault,eventListener,sender); } } - /// - /// transferring offers (copy or move) from source collection to target collection(s) - /// + /// Gets private store collections list /// - /// Transfer offers properties /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). @@ -2548,30 +3396,27 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionTransferOffersViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)/transferOffers$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections'"); } // replace URI parameters with values from identity var privateStoreId = _match.Groups["privateStoreId"].Value; - var collectionId = _match.Groups["collectionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + privateStoreId - + "/collections/" - + collectionId - + "/transferOffers" + + "/collections" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -2580,109 +3425,72 @@ public partial class Marketplace // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); - request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreCollectionTransferOffers_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreCollectionList_Call (request, onOk,onDefault,eventListener,sender); } } - /// - /// Actual wire call for method. - /// - /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// Gets private store collections list + /// /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionTransferOffers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { + var apiVersion = @"2023-01-01"; + // Constant Parameters using( NoSynchronizationContext ) { - global::System.Net.Http.HttpResponseMessage _response = null; - try - { - var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - var _contentType = _response.Content.Headers.ContentType?.MediaType; + // verify that Identity format is an exact match for uri - switch ( _response.StatusCode ) - { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.TransferOffersResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections'"); } - } - } - /// - /// Validation method for method. Call this like the actual call, but - /// you will get validation events back. - /// - /// The store ID - must use the tenant ID - /// The collection ID - /// Transfer offers properties - /// an instance that will receive events. - /// - /// A that will be complete when handling of the response is completed. - /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionTransferOffers_Validate(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) - { - using( NoSynchronizationContext ) - { - await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); - await eventListener.AssertNotNull(nameof(collectionId),collectionId); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/collections" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionListWithResult_Call (request, eventListener,sender); } } - /// - /// For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied - /// list. - /// + /// Gets private store collections list /// The store ID - must use the tenant ID - /// The subscriptions list to get the related collections - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionsToSubscriptionsMapping(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionListWithResult(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2690,87 +3498,87 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + global::System.Uri.EscapeDataString(privateStoreId) - + "/collectionsToSubscriptionsMapping" + + "/collections" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); - request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.PrivateStoreCollectionsToSubscriptionsMapping_Call(request,onOk,onDefault,eventListener,sender); + return await this.PrivateStoreCollectionListWithResult_Call (request, eventListener,sender); } } /// - /// For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied - /// list. + /// Actual wire call for method. /// - /// - /// The subscriptions list to get the related collections - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// the prepared HttpRequestMessage to send. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCollectionsToSubscriptionsMappingViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; - // Constant Parameters using( NoSynchronizationContext ) { - // verify that Identity format is an exact match for uri + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collectionsToSubscriptionsMapping$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collectionsToSubscriptionsMapping'"); + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); } - - // replace URI parameters with values from identity - var privateStoreId = _match.Groups["privateStoreId"].Value; - // construct URL - var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.Marketplace/privateStores/" - + privateStoreId - + "/collectionsToSubscriptionsMapping" - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); - request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.PrivateStoreCollectionsToSubscriptionsMapping_Call(request,onOk,onDefault,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -2780,7 +3588,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionsToSubscriptionsMapping_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -2791,6 +3599,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -2798,13 +3607,13 @@ public partial class Marketplace case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsToSubscriptionsMappingResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -2820,40 +3629,39 @@ public partial class Marketplace } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. /// /// The store ID - must use the tenant ID - /// The subscriptions list to get the related collections /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCollectionsToSubscriptionsMapping_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionList_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Create approval request + /// Update or add an offer to a specific collection of the private store. /// The store ID - must use the tenant ID - /// The request approval ID to get create or update - /// Request approval resource. + /// The collection ID + /// The offer ID to update or delete + /// The privateStore offer data structure. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCreateApprovalRequest(string privateStoreId, string requestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferCreateOrUpdate(string privateStoreId, string collectionId, string offerId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2861,8 +3669,10 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + global::System.Uri.EscapeDataString(privateStoreId) - + "/requestApprovals/" - + global::System.Uri.EscapeDataString(requestApprovalId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/offers/" + + global::System.Uri.EscapeDataString(offerId) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -2876,48 +3686,52 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreCreateApprovalRequest_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreCollectionOfferCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); } } - /// Create approval request + /// Update or add an offer to a specific collection of the private store. /// - /// Request approval resource. + /// The privateStore offer data structure. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCreateApprovalRequestViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/requestApprovals/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)/offers/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals/{requestApprovalId}'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}'"); } // replace URI parameters with values from identity var privateStoreId = _match.Groups["privateStoreId"].Value; - var requestApprovalId = _match.Groups["requestApprovalId"].Value; + var collectionId = _match.Groups["collectionId"].Value; + var offerId = _match.Groups["offerId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + privateStoreId - + "/requestApprovals/" - + requestApprovalId + + "/collections/" + + collectionId + + "/offers/" + + offerId + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -2931,88 +3745,76 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreCreateApprovalRequest_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreCollectionOfferCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. - /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// Update or add an offer to a specific collection of the private store. + /// + /// The privateStore offer data structure. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// - /// A that will be complete when handling of the response is completed. + /// A that + /// will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCreateApprovalRequest_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferCreateOrUpdateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { + var apiVersion = @"2023-01-01"; + // Constant Parameters using( NoSynchronizationContext ) { - global::System.Net.Http.HttpResponseMessage _response = null; - try - { - var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - var _contentType = _response.Content.Headers.ContentType?.MediaType; + // verify that Identity format is an exact match for uri - switch ( _response.StatusCode ) - { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)/offers/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}'"); } - } - } - /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. - /// - /// The store ID - must use the tenant ID - /// The request approval ID to get create or update - /// Request approval resource. - /// an instance that will receive events. - /// - /// A that will be complete when handling of the response is completed. - /// - internal async global::System.Threading.Tasks.Task PrivateStoreCreateApprovalRequest_Validate(string privateStoreId, string requestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) - { - using( NoSynchronizationContext ) - { - await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); - await eventListener.AssertNotNull(nameof(requestApprovalId),requestApprovalId); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var collectionId = _match.Groups["collectionId"].Value; + var offerId = _match.Groups["offerId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/collections/" + + collectionId + + "/offers/" + + offerId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionOfferCreateOrUpdateWithResult_Call (request, eventListener,sender); } } - /// Changes private store properties + /// Update or add an offer to a specific collection of the private store. /// The store ID - must use the tenant ID - /// The PrivateStore data structure. + /// The collection ID + /// The offer ID to update or delete + /// Json string supplied to the PrivateStoreCollectionOfferCreateOrUpdate operation /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). @@ -3021,9 +3823,9 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCreateOrUpdate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferCreateOrUpdateViaJsonString(string privateStoreId, string collectionId, string offerId, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -3031,6 +3833,10 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/offers/" + + global::System.Uri.EscapeDataString(offerId) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3044,67 +3850,172 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreCollectionOfferCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); } } - /// Changes private store properties - /// - /// The PrivateStore data structure. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// Update or add an offer to a specific collection of the private store. + /// The store ID - must use the tenant ID + /// The collection ID + /// The offer ID to update or delete + /// Json string supplied to the PrivateStoreCollectionOfferCreateOrUpdate operation /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A that + /// will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferCreateOrUpdateViaJsonStringWithResult(string privateStoreId, string collectionId, string offerId, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { - // verify that Identity format is an exact match for uri + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/offers/" + + global::System.Uri.EscapeDataString(offerId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); - } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - // replace URI parameters with values from identity - var privateStoreId = _match.Groups["privateStoreId"].Value; + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionOfferCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// Update or add an offer to a specific collection of the private store. + /// The store ID - must use the tenant ID + /// The collection ID + /// The offer ID to update or delete + /// The privateStore offer data structure. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that + /// will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferCreateOrUpdateWithResult(string privateStoreId, string collectionId, string offerId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" - + privateStoreId + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/offers/" + + global::System.Uri.EscapeDataString(offerId) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.PrivateStoreCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + return await this.PrivateStoreCollectionOfferCreateOrUpdateWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that + /// will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferCreateOrUpdateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Offer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } } } - /// Actual wire call for method. + /// + /// Actual wire call for method. + /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -3114,7 +4025,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -3125,6 +4036,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -3132,13 +4044,13 @@ public partial class Marketplace case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Offer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -3154,27 +4066,33 @@ public partial class Marketplace } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. /// /// The store ID - must use the tenant ID - /// The PrivateStore data structure. + /// The collection ID + /// The offer ID to update or delete + /// The privateStore offer data structure. /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreCreateOrUpdate_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferCreateOrUpdate_Validate(string privateStoreId, string collectionId, string offerId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(collectionId),collectionId); + await eventListener.AssertNotNull(nameof(offerId),offerId); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Deletes the private store. All that is not saved will be lost. + /// Deletes an offer from the given collection of private store. /// The store ID - must use the tenant ID + /// The collection ID + /// The offer ID to update or delete /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns 204 (NoContent). /// a delegate that is called when the remote service returns default (any response code not handled @@ -3184,9 +4102,9 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreDelete(string privateStoreId, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferDelete(string privateStoreId, string collectionId, string offerId, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -3194,6 +4112,10 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/offers/" + + global::System.Uri.EscapeDataString(offerId) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3207,11 +4129,11 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + await this.PrivateStoreCollectionOfferDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); } } - /// Deletes the private store. All that is not saved will be lost. + /// Deletes an offer from the given collection of private store. /// /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns 204 (NoContent). @@ -3222,26 +4144,32 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)/offers/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}'"); } // replace URI parameters with values from identity var privateStoreId = _match.Groups["privateStoreId"].Value; + var collectionId = _match.Groups["collectionId"].Value; + var offerId = _match.Groups["offerId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + privateStoreId + + "/collections/" + + collectionId + + "/offers/" + + offerId + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3255,11 +4183,11 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + await this.PrivateStoreCollectionOfferDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns 204 (NoContent). @@ -3270,7 +4198,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -3281,6 +4209,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -3300,7 +4229,7 @@ public partial class Marketplace default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -3316,24 +4245,30 @@ public partial class Marketplace } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. /// /// The store ID - must use the tenant ID + /// The collection ID + /// The offer ID to update or delete /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreDelete_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferDelete_Validate(string privateStoreId, string collectionId, string offerId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(collectionId),collectionId); + await eventListener.AssertNotNull(nameof(offerId),offerId); } } - /// Get information about the private store + /// Gets information about a specific offer. /// The store ID - must use the tenant ID + /// The collection ID + /// The offer ID to update or delete /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). @@ -3342,9 +4277,9 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreGet(string privateStoreId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferGet(string privateStoreId, string collectionId, string offerId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -3352,6 +4287,10 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/offers/" + + global::System.Uri.EscapeDataString(offerId) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3365,14 +4304,12 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreGet_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreCollectionOfferGet_Call (request, onOk,onDefault,eventListener,sender); } } - /// Get open approval requests - /// The store ID - must use the tenant ID - /// The admin request approval ID to get create or update - /// The publisher id of this offer. + /// Gets information about a specific offer. + /// /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). @@ -3381,22 +4318,34 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreGetAdminRequestApproval(string privateStoreId, string adminRequestApprovalId, string publisherId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)/offers/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var collectionId = _match.Groups["collectionId"].Value; + var offerId = _match.Groups["offerId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" - + global::System.Uri.EscapeDataString(privateStoreId) - + "/adminRequestApprovals/" - + global::System.Uri.EscapeDataString(adminRequestApprovalId) + + privateStoreId + + "/collections/" + + collectionId + + "/offers/" + + offerId + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - + "&" - + "publisherId=" + global::System.Uri.EscapeDataString(publisherId) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -3408,74 +4357,113 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreGetAdminRequestApproval_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreCollectionOfferGet_Call (request, onOk,onDefault,eventListener,sender); } } - /// Get open approval requests + /// Gets information about a specific offer. /// - /// The publisher id of this offer. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A that + /// will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreGetAdminRequestApprovalViaIdentity(global::System.String viaIdentity, string publisherId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/adminRequestApprovals/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)/offers/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/adminRequestApprovals/{adminRequestApprovalId}'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}'"); } // replace URI parameters with values from identity var privateStoreId = _match.Groups["privateStoreId"].Value; - var adminRequestApprovalId = _match.Groups["adminRequestApprovalId"].Value; + var collectionId = _match.Groups["collectionId"].Value; + var offerId = _match.Groups["offerId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + privateStoreId - + "/adminRequestApprovals/" - + adminRequestApprovalId + + "/collections/" + + collectionId + + "/offers/" + + offerId + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - + "&" - + "publisherId=" + global::System.Uri.EscapeDataString(publisherId) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionOfferGetWithResult_Call (request, eventListener,sender); + } + } + + /// Gets information about a specific offer. + /// The store ID - must use the tenant ID + /// The collection ID + /// The offer ID to update or delete + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that + /// will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferGetWithResult(string privateStoreId, string collectionId, string offerId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/offers/" + + global::System.Uri.EscapeDataString(offerId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.PrivateStoreGetAdminRequestApproval_Call(request,onOk,onDefault,eventListener,sender); + return await this.PrivateStoreCollectionOfferGetWithResult_Call (request, eventListener,sender); } } - /// Actual wire call for method. + /// + /// Actual wire call for method. + /// /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A that + /// will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreGetAdminRequestApproval_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -3483,24 +4471,37 @@ public partial class Marketplace try { var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AdminRequestApprovalsResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Offer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; } default: { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } } } } @@ -3514,124 +4515,17 @@ public partial class Marketplace } } - /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. - /// - /// The store ID - must use the tenant ID - /// The admin request approval ID to get create or update - /// The publisher id of this offer. + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreGetAdminRequestApproval_Validate(string privateStoreId, string adminRequestApprovalId, string publisherId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) - { - using( NoSynchronizationContext ) - { - await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); - await eventListener.AssertNotNull(nameof(adminRequestApprovalId),adminRequestApprovalId); - await eventListener.AssertNotNull(nameof(publisherId),publisherId); - } - } - - /// Get all open approval requests of current user - /// The store ID - must use the tenant ID - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. - /// - /// A that will be complete when handling of the response is completed. - /// - public async global::System.Threading.Tasks.Task PrivateStoreGetApprovalRequestsList(string privateStoreId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) - { - var apiVersion = @"2021-06-01"; - // Constant Parameters - using( NoSynchronizationContext ) - { - // construct URL - var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.Marketplace/privateStores/" - + global::System.Uri.EscapeDataString(privateStoreId) - + "/requestApprovals" - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.PrivateStoreGetApprovalRequestsList_Call(request,onOk,onDefault,eventListener,sender); - } - } - - /// Get all open approval requests of current user - /// - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. - /// - /// A that will be complete when handling of the response is completed. - /// - public async global::System.Threading.Tasks.Task PrivateStoreGetApprovalRequestsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) - { - var apiVersion = @"2021-06-01"; - // Constant Parameters - using( NoSynchronizationContext ) - { - // verify that Identity format is an exact match for uri - - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/requestApprovals$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals'"); - } - - // replace URI parameters with values from identity - var privateStoreId = _match.Groups["privateStoreId"].Value; - // construct URL - var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.Marketplace/privateStores/" - + privateStoreId - + "/requestApprovals" - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.PrivateStoreGetApprovalRequestsList_Call(request,onOk,onDefault,eventListener,sender); - } - } - - /// Actual wire call for method. - /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. - /// - /// A that will be complete when handling of the response is completed. - /// - internal async global::System.Threading.Tasks.Task PrivateStoreGetApprovalRequestsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -3642,6 +4536,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -3649,13 +4544,13 @@ public partial class Marketplace case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Offer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -3671,25 +4566,29 @@ public partial class Marketplace } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. /// /// The store ID - must use the tenant ID + /// The collection ID + /// The offer ID to update or delete /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreGetApprovalRequestsList_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferGet_Validate(string privateStoreId, string collectionId, string offerId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(collectionId),collectionId); + await eventListener.AssertNotNull(nameof(offerId),offerId); } } - /// Get open request approval details + /// Get a list of all private offers in the given private store and collection /// The store ID - must use the tenant ID - /// The request approval ID to get create or update + /// The collection ID /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). @@ -3698,9 +4597,9 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreGetRequestApproval(string privateStoreId, string requestApprovalId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferList(string privateStoreId, string collectionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -3708,8 +4607,9 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + global::System.Uri.EscapeDataString(privateStoreId) - + "/requestApprovals/" - + global::System.Uri.EscapeDataString(requestApprovalId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/offers" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3723,43 +4623,38 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreGetRequestApproval_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreCollectionOfferList_Call (request, onOk,onDefault,eventListener,sender); } } - /// Get open request approval details - /// + /// + /// Get a list of all offers in the given collection according to the required contexts. + /// + /// The store ID - must use the tenant ID + /// The collection ID + /// Suggested subscription list /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreGetRequestApprovalViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferListByContexts(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayload body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { - // verify that Identity format is an exact match for uri - - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/requestApprovals/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals/{requestApprovalId}'"); - } - - // replace URI parameters with values from identity - var privateStoreId = _match.Groups["privateStoreId"].Value; - var requestApprovalId = _match.Groups["requestApprovalId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" - + privateStoreId - + "/requestApprovals/" - + requestApprovalId + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/mapOffersToContexts" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3768,132 +4663,141 @@ public partial class Marketplace // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreGetRequestApproval_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreCollectionOfferListByContexts_Call (request, onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. - /// the prepared HttpRequestMessage to send. + /// + /// Get a list of all offers in the given collection according to the required contexts. + /// + /// + /// Suggested subscription list /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreGetRequestApproval_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferListByContextsViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayload body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { + var apiVersion = @"2023-01-01"; + // Constant Parameters using( NoSynchronizationContext ) { - global::System.Net.Http.HttpResponseMessage _response = null; - try - { - var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - var _contentType = _response.Content.Headers.ContentType?.MediaType; + // verify that Identity format is an exact match for uri - switch ( _response.StatusCode ) - { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}'"); } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var collectionId = _match.Groups["collectionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/collections/" + + collectionId + + "/mapOffersToContexts" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCollectionOfferListByContexts_Call (request, onOk,onDefault,eventListener,sender); } } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// Get a list of all offers in the given collection according to the required contexts. /// - /// The store ID - must use the tenant ID - /// The request approval ID to get create or update - /// an instance that will receive events. - /// - /// A that will be complete when handling of the response is completed. - /// - internal async global::System.Threading.Tasks.Task PrivateStoreGetRequestApproval_Validate(string privateStoreId, string requestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) - { - using( NoSynchronizationContext ) - { - await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); - await eventListener.AssertNotNull(nameof(requestApprovalId),requestApprovalId); - } - } - - /// Get information about the private store /// - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// Suggested subscription list /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferListByContextsViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayload body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}'"); } // replace URI parameters with values from identity var privateStoreId = _match.Groups["privateStoreId"].Value; + var collectionId = _match.Groups["collectionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + privateStoreId + + "/collections/" + + collectionId + + "/mapOffersToContexts" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.PrivateStoreGet_Call(request,onOk,onDefault,eventListener,sender); + return await this.PrivateStoreCollectionOfferListByContextsWithResult_Call (request, eventListener,sender); } } - /// Actual wire call for method. - /// the prepared HttpRequestMessage to send. + /// + /// Get a list of all offers in the given collection according to the required contexts. + /// + /// The store ID - must use the tenant ID + /// The collection ID + /// Json string supplied to the PrivateStoreCollectionOfferListByContexts operation /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). @@ -3902,31 +4806,7752 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferListByContextsViaJsonString(string privateStoreId, string collectionId, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { + var apiVersion = @"2023-01-01"; + // Constant Parameters using( NoSynchronizationContext ) { - global::System.Net.Http.HttpResponseMessage _response = null; - try - { - var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - var _contentType = _response.Content.Headers.ContentType?.MediaType; - - switch ( _response.StatusCode ) - { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStore.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/mapOffersToContexts" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCollectionOfferListByContexts_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Get a list of all offers in the given collection according to the required contexts. + /// + /// The store ID - must use the tenant ID + /// The collection ID + /// Json string supplied to the PrivateStoreCollectionOfferListByContexts operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferListByContextsViaJsonStringWithResult(string privateStoreId, string collectionId, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/mapOffersToContexts" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionOfferListByContextsWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Get a list of all offers in the given collection according to the required contexts. + /// + /// The store ID - must use the tenant ID + /// The collection ID + /// Suggested subscription list + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferListByContextsWithResult(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayload body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/mapOffersToContexts" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionOfferListByContextsWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferListByContextsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByContextList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferListByContexts_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByContextList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The store ID - must use the tenant ID + /// The collection ID + /// Suggested subscription list + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferListByContexts_Validate(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayload body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(collectionId),collectionId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Get a list of all private offers in the given private store and collection + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)/offers$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var collectionId = _match.Groups["collectionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/collections/" + + collectionId + + "/offers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCollectionOfferList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get a list of all private offers in the given private store and collection + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)/offers$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var collectionId = _match.Groups["collectionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/collections/" + + collectionId + + "/offers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionOfferListWithResult_Call (request, eventListener,sender); + } + } + + /// Get a list of all private offers in the given private store and collection + /// The store ID - must use the tenant ID + /// The collection ID + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferListWithResult(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/offers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionOfferListWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The store ID - must use the tenant ID + /// The collection ID + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferList_Validate(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(collectionId),collectionId); + } + } + + /// Delete Private store offer. This is a workaround. + /// The store ID - must use the tenant ID + /// The collection ID + /// The offer ID to update or delete + /// Set the Operation for the POST method. Ping or Delete + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferPost(string privateStoreId, string collectionId, string offerId, string body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/offers/" + + global::System.Uri.EscapeDataString(offerId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = null /* serializeToContent doesn't support 'application/json' C:\Users\cloudtest\.autorest\@autorest_powershell@4.0.674\node_modules\@autorest\powershell\dist\llcsharp\schema\string.js*/; + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCollectionOfferPost_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Delete Private store offer. This is a workaround. + /// + /// Set the Operation for the POST method. Ping or Delete + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferPostViaIdentity(global::System.String viaIdentity, string body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)/offers$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var collectionId = _match.Groups["collectionId"].Value; + var offerId = _match.Groups["offerId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/collections/" + + collectionId + + "/offers/" + + offerId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = null /* serializeToContent doesn't support 'application/json' C:\Users\cloudtest\.autorest\@autorest_powershell@4.0.674\node_modules\@autorest\powershell\dist\llcsharp\schema\string.js*/; + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCollectionOfferPost_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Delete Private store offer. This is a workaround. + /// The store ID - must use the tenant ID + /// The collection ID + /// The offer ID to update or delete + /// Json string supplied to the PrivateStoreCollectionOfferPost operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferPostViaJsonString(string privateStoreId, string collectionId, string offerId, global::System.String jsonString, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/offers/" + + global::System.Uri.EscapeDataString(offerId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCollectionOfferPost_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferPost_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The store ID - must use the tenant ID + /// The collection ID + /// The offer ID to update or delete + /// Set the Operation for the POST method. Ping or Delete + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferPost_Validate(string privateStoreId, string collectionId, string offerId, string body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(collectionId),collectionId); + await eventListener.AssertNotNull(nameof(offerId),offerId); + await eventListener.AssertNotNull(nameof(body),body); + } + } + + /// Upsert an offer with multiple context details. + /// The store ID - must use the tenant ID + /// The collection ID + /// The offer ID to update or delete + /// Payload object for upsert offer with multiple context and plans. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferUpsertOfferWithMultiContext(string privateStoreId, string collectionId, string offerId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayload body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/offers/" + + global::System.Uri.EscapeDataString(offerId) + + "/upsertOfferWithMultiContext" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCollectionOfferUpsertOfferWithMultiContext_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Upsert an offer with multiple context details. + /// + /// Payload object for upsert offer with multiple context and plans. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferUpsertOfferWithMultiContextViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayload body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)/offers/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var collectionId = _match.Groups["collectionId"].Value; + var offerId = _match.Groups["offerId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/collections/" + + collectionId + + "/offers/" + + offerId + + "/upsertOfferWithMultiContext" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCollectionOfferUpsertOfferWithMultiContext_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Upsert an offer with multiple context details. + /// + /// Payload object for upsert offer with multiple context and plans. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that + /// will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferUpsertOfferWithMultiContextViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayload body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)/offers/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var collectionId = _match.Groups["collectionId"].Value; + var offerId = _match.Groups["offerId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/collections/" + + collectionId + + "/offers/" + + offerId + + "/upsertOfferWithMultiContext" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionOfferUpsertOfferWithMultiContextWithResult_Call (request, eventListener,sender); + } + } + + /// Upsert an offer with multiple context details. + /// The store ID - must use the tenant ID + /// The collection ID + /// The offer ID to update or delete + /// Json string supplied to the PrivateStoreCollectionOfferUpsertOfferWithMultiContext operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferUpsertOfferWithMultiContextViaJsonString(string privateStoreId, string collectionId, string offerId, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/offers/" + + global::System.Uri.EscapeDataString(offerId) + + "/upsertOfferWithMultiContext" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCollectionOfferUpsertOfferWithMultiContext_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Upsert an offer with multiple context details. + /// The store ID - must use the tenant ID + /// The collection ID + /// The offer ID to update or delete + /// Json string supplied to the PrivateStoreCollectionOfferUpsertOfferWithMultiContext operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that + /// will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferUpsertOfferWithMultiContextViaJsonStringWithResult(string privateStoreId, string collectionId, string offerId, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/offers/" + + global::System.Uri.EscapeDataString(offerId) + + "/upsertOfferWithMultiContext" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionOfferUpsertOfferWithMultiContextWithResult_Call (request, eventListener,sender); + } + } + + /// Upsert an offer with multiple context details. + /// The store ID - must use the tenant ID + /// The collection ID + /// The offer ID to update or delete + /// Payload object for upsert offer with multiple context and plans. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that + /// will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferUpsertOfferWithMultiContextWithResult(string privateStoreId, string collectionId, string offerId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayload body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/offers/" + + global::System.Uri.EscapeDataString(offerId) + + "/upsertOfferWithMultiContext" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionOfferUpsertOfferWithMultiContextWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that + /// will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferUpsertOfferWithMultiContextWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Offer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferUpsertOfferWithMultiContext_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Offer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the + /// actual call, but you will get validation events back. + /// + /// The store ID - must use the tenant ID + /// The collection ID + /// The offer ID to update or delete + /// Payload object for upsert offer with multiple context and plans. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionOfferUpsertOfferWithMultiContext_Validate(string privateStoreId, string collectionId, string offerId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayload body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(collectionId),collectionId); + await eventListener.AssertNotNull(nameof(offerId),offerId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Delete Private store collection. This is a workaround. + /// The store ID - must use the tenant ID + /// The collection ID + /// Set the Operation for the POST method. Ping or Delete + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionPost(string privateStoreId, string collectionId, string body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = null /* serializeToContent doesn't support 'application/json' C:\Users\cloudtest\.autorest\@autorest_powershell@4.0.674\node_modules\@autorest\powershell\dist\llcsharp\schema\string.js*/; + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCollectionPost_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Delete Private store collection. This is a workaround. + /// + /// Set the Operation for the POST method. Ping or Delete + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionPostViaIdentity(global::System.String viaIdentity, string body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var collectionId = _match.Groups["collectionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/collections/" + + collectionId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = null /* serializeToContent doesn't support 'application/json' C:\Users\cloudtest\.autorest\@autorest_powershell@4.0.674\node_modules\@autorest\powershell\dist\llcsharp\schema\string.js*/; + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCollectionPost_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Delete Private store collection. This is a workaround. + /// The store ID - must use the tenant ID + /// The collection ID + /// Json string supplied to the PrivateStoreCollectionPost operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionPostViaJsonString(string privateStoreId, string collectionId, global::System.String jsonString, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCollectionPost_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionPost_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The store ID - must use the tenant ID + /// The collection ID + /// Set the Operation for the POST method. Ping or Delete + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionPost_Validate(string privateStoreId, string collectionId, string body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(collectionId),collectionId); + await eventListener.AssertNotNull(nameof(body),body); + } + } + + /// + /// transferring offers (copy or move) from source collection to target collection(s) + /// + /// The store ID - must use the tenant ID + /// The collection ID + /// Transfer offers properties + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionTransferOffers(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/transferOffers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCollectionTransferOffers_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// transferring offers (copy or move) from source collection to target collection(s) + /// + /// + /// Transfer offers properties + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionTransferOffersViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var collectionId = _match.Groups["collectionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/collections/" + + collectionId + + "/transferOffers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCollectionTransferOffers_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// transferring offers (copy or move) from source collection to target collection(s) + /// + /// + /// Transfer offers properties + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionTransferOffersViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var collectionId = _match.Groups["collectionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/collections/" + + collectionId + + "/transferOffers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionTransferOffersWithResult_Call (request, eventListener,sender); + } + } + + /// + /// transferring offers (copy or move) from source collection to target collection(s) + /// + /// The store ID - must use the tenant ID + /// The collection ID + /// Json string supplied to the PrivateStoreCollectionTransferOffers operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionTransferOffersViaJsonString(string privateStoreId, string collectionId, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/transferOffers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCollectionTransferOffers_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// transferring offers (copy or move) from source collection to target collection(s) + /// + /// The store ID - must use the tenant ID + /// The collection ID + /// Json string supplied to the PrivateStoreCollectionTransferOffers operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionTransferOffersViaJsonStringWithResult(string privateStoreId, string collectionId, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/transferOffers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionTransferOffersWithResult_Call (request, eventListener,sender); + } + } + + /// + /// transferring offers (copy or move) from source collection to target collection(s) + /// + /// The store ID - must use the tenant ID + /// The collection ID + /// Transfer offers properties + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionTransferOffersWithResult(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/transferOffers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionTransferOffersWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionTransferOffersWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.TransferOffersResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionTransferOffers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.TransferOffersResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The store ID - must use the tenant ID + /// The collection ID + /// Transfer offers properties + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionTransferOffers_Validate(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(collectionId),collectionId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied + /// list. + /// + /// The store ID - must use the tenant ID + /// The subscriptions list to get the related collections + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionsToSubscriptionsMapping(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collectionsToSubscriptionsMapping" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCollectionsToSubscriptionsMapping_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied + /// list. + /// + /// + /// The subscriptions list to get the related collections + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionsToSubscriptionsMappingViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/collectionsToSubscriptionsMapping" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCollectionsToSubscriptionsMapping_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied + /// list. + /// + /// + /// The subscriptions list to get the related collections + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionsToSubscriptionsMappingViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/collectionsToSubscriptionsMapping" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionsToSubscriptionsMappingWithResult_Call (request, eventListener,sender); + } + } + + /// + /// For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied + /// list. + /// + /// The store ID - must use the tenant ID + /// Json string supplied to the PrivateStoreCollectionsToSubscriptionsMapping operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionsToSubscriptionsMappingViaJsonString(string privateStoreId, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collectionsToSubscriptionsMapping" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCollectionsToSubscriptionsMapping_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied + /// list. + /// + /// The store ID - must use the tenant ID + /// Json string supplied to the PrivateStoreCollectionsToSubscriptionsMapping operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionsToSubscriptionsMappingViaJsonStringWithResult(string privateStoreId, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collectionsToSubscriptionsMapping" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionsToSubscriptionsMappingWithResult_Call (request, eventListener,sender); + } + } + + /// + /// For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied + /// list. + /// + /// The store ID - must use the tenant ID + /// The subscriptions list to get the related collections + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCollectionsToSubscriptionsMappingWithResult(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collectionsToSubscriptionsMapping" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCollectionsToSubscriptionsMappingWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionsToSubscriptionsMappingWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsToSubscriptionsMappingResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionsToSubscriptionsMapping_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsToSubscriptionsMappingResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The store ID - must use the tenant ID + /// The subscriptions list to get the related collections + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCollectionsToSubscriptionsMapping_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Create approval request + /// The store ID - must use the tenant ID + /// The request approval ID to get create or update + /// Request approval resource. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCreateApprovalRequest(string privateStoreId, string requestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/requestApprovals/" + + global::System.Uri.EscapeDataString(requestApprovalId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCreateApprovalRequest_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Create approval request + /// + /// Request approval resource. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCreateApprovalRequestViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/requestApprovals/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals/{requestApprovalId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var requestApprovalId = _match.Groups["requestApprovalId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/requestApprovals/" + + requestApprovalId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCreateApprovalRequest_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Create approval request + /// + /// Request approval resource. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCreateApprovalRequestViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResource body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/requestApprovals/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals/{requestApprovalId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var requestApprovalId = _match.Groups["requestApprovalId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/requestApprovals/" + + requestApprovalId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCreateApprovalRequestWithResult_Call (request, eventListener,sender); + } + } + + /// Create approval request + /// The store ID - must use the tenant ID + /// The request approval ID to get create or update + /// Json string supplied to the PrivateStoreCreateApprovalRequest operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCreateApprovalRequestViaJsonString(string privateStoreId, string requestApprovalId, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/requestApprovals/" + + global::System.Uri.EscapeDataString(requestApprovalId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCreateApprovalRequest_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Create approval request + /// The store ID - must use the tenant ID + /// The request approval ID to get create or update + /// Json string supplied to the PrivateStoreCreateApprovalRequest operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCreateApprovalRequestViaJsonStringWithResult(string privateStoreId, string requestApprovalId, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/requestApprovals/" + + global::System.Uri.EscapeDataString(requestApprovalId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCreateApprovalRequestWithResult_Call (request, eventListener,sender); + } + } + + /// Create approval request + /// The store ID - must use the tenant ID + /// The request approval ID to get create or update + /// Request approval resource. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCreateApprovalRequestWithResult(string privateStoreId, string requestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResource body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/requestApprovals/" + + global::System.Uri.EscapeDataString(requestApprovalId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreCreateApprovalRequestWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCreateApprovalRequestWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCreateApprovalRequest_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The store ID - must use the tenant ID + /// The request approval ID to get create or update + /// Request approval resource. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCreateApprovalRequest_Validate(string privateStoreId, string requestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResource body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(requestApprovalId),requestApprovalId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Changes private store properties + /// The store ID - must use the tenant ID + /// The PrivateStore data structure. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCreateOrUpdate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Changes private store properties + /// + /// The PrivateStore data structure. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Changes private store properties + /// The store ID - must use the tenant ID + /// Json string supplied to the PrivateStoreCreateOrUpdate operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreCreateOrUpdateViaJsonString(string privateStoreId, global::System.String jsonString, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreCreateOrUpdate_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The store ID - must use the tenant ID + /// The PrivateStore data structure. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreCreateOrUpdate_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Deletes the private store. All that is not saved will be lost. + /// The store ID - must use the tenant ID + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreDelete(string privateStoreId, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Deletes the private store. All that is not saved will be lost. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreDelete_Call (request, onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The store ID - must use the tenant ID + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreDelete_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + } + } + + /// Fetch all subscriptions in tenant, only for marketplace admin + /// The store ID - must use the tenant ID + /// The skip token to get the next page. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreFetchAllSubscriptionsInTenant(string privateStoreId, string nextPageToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/fetchAllSubscriptionsInTenant" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != nextPageToken) + { + request.Headers.Add("next-page-token",nextPageToken); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreFetchAllSubscriptionsInTenant_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Fetch all subscriptions in tenant, only for marketplace admin + /// + /// The skip token to get the next page. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreFetchAllSubscriptionsInTenantViaIdentity(global::System.String viaIdentity, string nextPageToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/fetchAllSubscriptionsInTenant" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != nextPageToken) + { + request.Headers.Add("next-page-token",nextPageToken); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreFetchAllSubscriptionsInTenant_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Fetch all subscriptions in tenant, only for marketplace admin + /// + /// The skip token to get the next page. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreFetchAllSubscriptionsInTenantViaIdentityWithResult(global::System.String viaIdentity, string nextPageToken, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/fetchAllSubscriptionsInTenant" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // add headers parameters + if (null != nextPageToken) + { + request.Headers.Add("next-page-token",nextPageToken); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreFetchAllSubscriptionsInTenantWithResult_Call (request, eventListener,sender); + } + } + + /// Fetch all subscriptions in tenant, only for marketplace admin + /// The store ID - must use the tenant ID + /// The skip token to get the next page. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreFetchAllSubscriptionsInTenantWithResult(string privateStoreId, string nextPageToken, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/fetchAllSubscriptionsInTenant" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // add headers parameters + if (null != nextPageToken) + { + request.Headers.Add("next-page-token",nextPageToken); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreFetchAllSubscriptionsInTenantWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreFetchAllSubscriptionsInTenantWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SubscriptionsResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreFetchAllSubscriptionsInTenant_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SubscriptionsResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// The store ID - must use the tenant ID + /// The skip token to get the next page. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreFetchAllSubscriptionsInTenant_Validate(string privateStoreId, string nextPageToken, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(nextPageToken),nextPageToken); + } + } + + /// Get information about the private store + /// The store ID - must use the tenant ID + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreGet(string privateStoreId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get open approval requests + /// The store ID - must use the tenant ID + /// The admin request approval ID to get create or update + /// The publisher id of this offer. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreGetAdminRequestApproval(string privateStoreId, string adminRequestApprovalId, string publisherId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/adminRequestApprovals/" + + global::System.Uri.EscapeDataString(adminRequestApprovalId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + "publisherId=" + global::System.Uri.EscapeDataString(publisherId) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreGetAdminRequestApproval_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get open approval requests + /// + /// The publisher id of this offer. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreGetAdminRequestApprovalViaIdentity(global::System.String viaIdentity, string publisherId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/adminRequestApprovals/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/adminRequestApprovals/{adminRequestApprovalId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var adminRequestApprovalId = _match.Groups["adminRequestApprovalId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/adminRequestApprovals/" + + adminRequestApprovalId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + "publisherId=" + global::System.Uri.EscapeDataString(publisherId) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreGetAdminRequestApproval_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get open approval requests + /// + /// The publisher id of this offer. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreGetAdminRequestApprovalViaIdentityWithResult(global::System.String viaIdentity, string publisherId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/adminRequestApprovals/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/adminRequestApprovals/{adminRequestApprovalId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var adminRequestApprovalId = _match.Groups["adminRequestApprovalId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/adminRequestApprovals/" + + adminRequestApprovalId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + "publisherId=" + global::System.Uri.EscapeDataString(publisherId) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreGetAdminRequestApprovalWithResult_Call (request, eventListener,sender); + } + } + + /// Get open approval requests + /// The store ID - must use the tenant ID + /// The admin request approval ID to get create or update + /// The publisher id of this offer. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreGetAdminRequestApprovalWithResult(string privateStoreId, string adminRequestApprovalId, string publisherId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/adminRequestApprovals/" + + global::System.Uri.EscapeDataString(adminRequestApprovalId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + "publisherId=" + global::System.Uri.EscapeDataString(publisherId) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreGetAdminRequestApprovalWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreGetAdminRequestApprovalWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalsResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreGetAdminRequestApproval_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalsResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The store ID - must use the tenant ID + /// The admin request approval ID to get create or update + /// The publisher id of this offer. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreGetAdminRequestApproval_Validate(string privateStoreId, string adminRequestApprovalId, string publisherId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(adminRequestApprovalId),adminRequestApprovalId); + await eventListener.AssertNotNull(nameof(publisherId),publisherId); + } + } + + /// Get all open approval requests of current user + /// The store ID - must use the tenant ID + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreGetApprovalRequestsList(string privateStoreId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/requestApprovals" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreGetApprovalRequestsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get all open approval requests of current user + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreGetApprovalRequestsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/requestApprovals$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/requestApprovals" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreGetApprovalRequestsList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get all open approval requests of current user + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreGetApprovalRequestsListViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/requestApprovals$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/requestApprovals" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreGetApprovalRequestsListWithResult_Call (request, eventListener,sender); + } + } + + /// Get all open approval requests of current user + /// The store ID - must use the tenant ID + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreGetApprovalRequestsListWithResult(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/requestApprovals" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreGetApprovalRequestsListWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreGetApprovalRequestsListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreGetApprovalRequestsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The store ID - must use the tenant ID + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreGetApprovalRequestsList_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + } + } + + /// Get open request approval details + /// The store ID - must use the tenant ID + /// The request approval ID to get create or update + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreGetRequestApproval(string privateStoreId, string requestApprovalId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/requestApprovals/" + + global::System.Uri.EscapeDataString(requestApprovalId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreGetRequestApproval_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get open request approval details + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreGetRequestApprovalViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/requestApprovals/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals/{requestApprovalId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var requestApprovalId = _match.Groups["requestApprovalId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/requestApprovals/" + + requestApprovalId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreGetRequestApproval_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get open request approval details + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreGetRequestApprovalViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/requestApprovals/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals/{requestApprovalId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var requestApprovalId = _match.Groups["requestApprovalId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/requestApprovals/" + + requestApprovalId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreGetRequestApprovalWithResult_Call (request, eventListener,sender); + } + } + + /// Get open request approval details + /// The store ID - must use the tenant ID + /// The request approval ID to get create or update + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreGetRequestApprovalWithResult(string privateStoreId, string requestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/requestApprovals/" + + global::System.Uri.EscapeDataString(requestApprovalId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreGetRequestApprovalWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreGetRequestApprovalWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreGetRequestApproval_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The store ID - must use the tenant ID + /// The request approval ID to get create or update + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreGetRequestApproval_Validate(string privateStoreId, string requestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(requestApprovalId),requestApprovalId); + } + } + + /// Get information about the private store + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreGet_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get information about the private store + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreGetViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreGetWithResult_Call (request, eventListener,sender); + } + } + + /// Get information about the private store + /// The store ID - must use the tenant ID + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreGetWithResult(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreGetWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreGetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStore.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStore.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The store ID - must use the tenant ID + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreGet_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + } + } + + /// Gets the list of available private stores. + /// Determines if to use cache or DB for serving this request + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreList(string useCache, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(useCache) ? global::System.String.Empty : "use-cache=" + global::System.Uri.EscapeDataString(useCache)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// List new plans notifications + /// The store ID - must use the tenant ID + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreListNewPlansNotifications(string privateStoreId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/listNewPlansNotifications" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreListNewPlansNotifications_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// List new plans notifications + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreListNewPlansNotificationsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/listNewPlansNotifications" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreListNewPlansNotifications_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// List new plans notifications + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreListNewPlansNotificationsViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/listNewPlansNotifications" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreListNewPlansNotificationsWithResult_Call (request, eventListener,sender); + } + } + + /// List new plans notifications + /// The store ID - must use the tenant ID + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreListNewPlansNotificationsWithResult(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/listNewPlansNotifications" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreListNewPlansNotificationsWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreListNewPlansNotificationsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.NewPlansNotificationsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreListNewPlansNotifications_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.NewPlansNotificationsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The store ID - must use the tenant ID + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreListNewPlansNotifications_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + } + } + + /// List stop sell notifications for both stop sell offers and stop sell plans + /// The store ID - must use the tenant ID + /// Private plans subscriptions + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreListStopSellOffersPlansNotifications(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellSubscriptions body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/listStopSellOffersPlansNotifications" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreListStopSellOffersPlansNotifications_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// List stop sell notifications for both stop sell offers and stop sell plans + /// + /// Private plans subscriptions + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreListStopSellOffersPlansNotificationsViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellSubscriptions body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/listStopSellOffersPlansNotifications" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreListStopSellOffersPlansNotifications_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// List stop sell notifications for both stop sell offers and stop sell plans + /// + /// Private plans subscriptions + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreListStopSellOffersPlansNotificationsViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellSubscriptions body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/listStopSellOffersPlansNotifications" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreListStopSellOffersPlansNotificationsWithResult_Call (request, eventListener,sender); + } + } + + /// List stop sell notifications for both stop sell offers and stop sell plans + /// The store ID - must use the tenant ID + /// Json string supplied to the PrivateStoreListStopSellOffersPlansNotifications operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreListStopSellOffersPlansNotificationsViaJsonString(string privateStoreId, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/listStopSellOffersPlansNotifications" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreListStopSellOffersPlansNotifications_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// List stop sell notifications for both stop sell offers and stop sell plans + /// The store ID - must use the tenant ID + /// Json string supplied to the PrivateStoreListStopSellOffersPlansNotifications operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreListStopSellOffersPlansNotificationsViaJsonStringWithResult(string privateStoreId, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/listStopSellOffersPlansNotifications" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreListStopSellOffersPlansNotificationsWithResult_Call (request, eventListener,sender); + } + } + + /// List stop sell notifications for both stop sell offers and stop sell plans + /// The store ID - must use the tenant ID + /// Private plans subscriptions + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreListStopSellOffersPlansNotificationsWithResult(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellSubscriptions body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/listStopSellOffersPlansNotifications" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreListStopSellOffersPlansNotificationsWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreListStopSellOffersPlansNotificationsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.StopSellOffersPlansNotificationsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreListStopSellOffersPlansNotifications_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.StopSellOffersPlansNotificationsList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual + /// call, but you will get validation events back. + /// + /// The store ID - must use the tenant ID + /// Private plans subscriptions + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreListStopSellOffersPlansNotifications_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellSubscriptions body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// List all the subscriptions in the private store context + /// The store ID - must use the tenant ID + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreListSubscriptionsContext(string privateStoreId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/listSubscriptionsContext" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreListSubscriptionsContext_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// List all the subscriptions in the private store context + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreListSubscriptionsContextViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/listSubscriptionsContext" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreListSubscriptionsContext_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// List all the subscriptions in the private store context + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreListSubscriptionsContextViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/listSubscriptionsContext" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreListSubscriptionsContextWithResult_Call (request, eventListener,sender); + } + } + + /// List all the subscriptions in the private store context + /// The store ID - must use the tenant ID + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreListSubscriptionsContextWithResult(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/listSubscriptionsContext" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreListSubscriptionsContextWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreListSubscriptionsContextWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SubscriptionsContextList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreListSubscriptionsContext_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SubscriptionsContextList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// The store ID - must use the tenant ID + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreListSubscriptionsContext_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + } + } + + /// Gets the list of available private stores. + /// + /// Determines if to use cache or DB for serving this request + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreListViaIdentity(global::System.String viaIdentity, string useCache, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores'"); + } + + // replace URI parameters with values from identity + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(useCache) ? global::System.String.Empty : "use-cache=" + global::System.Uri.EscapeDataString(useCache)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreList_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Gets the list of available private stores. + /// + /// Determines if to use cache or DB for serving this request + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreListViaIdentityWithResult(global::System.String viaIdentity, string useCache, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores'"); + } + + // replace URI parameters with values from identity + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(useCache) ? global::System.String.Empty : "use-cache=" + global::System.Uri.EscapeDataString(useCache)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreListWithResult_Call (request, eventListener,sender); + } + } + + /// Gets the list of available private stores. + /// Determines if to use cache or DB for serving this request + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreListWithResult(string useCache, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(useCache) ? global::System.String.Empty : "use-cache=" + global::System.Uri.EscapeDataString(useCache)) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreListWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStoreList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStoreList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Determines if to use cache or DB for serving this request + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreList_Validate(string useCache, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(useCache),useCache); + } + } + + /// Get map of plans and related approved subscriptions. + /// The store ID - must use the tenant ID + /// Query approved plans payload + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryApprovedPlans(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayload body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/queryApprovedPlans" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreQueryApprovedPlans_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get map of plans and related approved subscriptions. + /// + /// Query approved plans payload + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryApprovedPlansViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayload body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/queryApprovedPlans" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreQueryApprovedPlans_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get map of plans and related approved subscriptions. + /// + /// Query approved plans payload + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryApprovedPlansViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayload body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/queryApprovedPlans" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreQueryApprovedPlansWithResult_Call (request, eventListener,sender); + } + } + + /// Get map of plans and related approved subscriptions. + /// The store ID - must use the tenant ID + /// Json string supplied to the PrivateStoreQueryApprovedPlans operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryApprovedPlansViaJsonString(string privateStoreId, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/queryApprovedPlans" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreQueryApprovedPlans_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get map of plans and related approved subscriptions. + /// The store ID - must use the tenant ID + /// Json string supplied to the PrivateStoreQueryApprovedPlans operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryApprovedPlansViaJsonStringWithResult(string privateStoreId, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/queryApprovedPlans" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreQueryApprovedPlansWithResult_Call (request, eventListener,sender); + } + } + + /// Get map of plans and related approved subscriptions. + /// The store ID - must use the tenant ID + /// Query approved plans payload + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryApprovedPlansWithResult(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayload body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/queryApprovedPlans" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreQueryApprovedPlansWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreQueryApprovedPlansWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryApprovedPlansResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreQueryApprovedPlans_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryApprovedPlansResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// The store ID - must use the tenant ID + /// Query approved plans payload + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreQueryApprovedPlans_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayload body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Get private store notifications state + /// The store ID - must use the tenant ID + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryNotificationsState(string privateStoreId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/queryNotificationsState" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreQueryNotificationsState_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get private store notifications state + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryNotificationsStateViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/queryNotificationsState" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreQueryNotificationsState_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get private store notifications state + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryNotificationsStateViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/queryNotificationsState" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreQueryNotificationsStateWithResult_Call (request, eventListener,sender); + } + } + + /// Get private store notifications state + /// The store ID - must use the tenant ID + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryNotificationsStateWithResult(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/queryNotificationsState" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreQueryNotificationsStateWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreQueryNotificationsStateWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStoreNotificationsState.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreQueryNotificationsState_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStoreNotificationsState.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The store ID - must use the tenant ID + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreQueryNotificationsState_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + } + } + + /// List of offers, regardless the collections + /// The store ID - must use the tenant ID + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryOffers(string privateStoreId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/queryOffers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreQueryOffers_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// List of offers, regardless the collections + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryOffersViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/queryOffers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreQueryOffers_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// List of offers, regardless the collections + /// + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryOffersViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/queryOffers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreQueryOffersWithResult_Call (request, eventListener,sender); + } + } + + /// List of offers, regardless the collections + /// The store ID - must use the tenant ID + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryOffersWithResult(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/queryOffers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreQueryOffersWithResult_Call (request, eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreQueryOffersWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryOffers.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreQueryOffers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryOffers.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// The store ID - must use the tenant ID + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreQueryOffers_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + } + } + + /// Get request statuses foreach plan, this api is used as a complex GET action. + /// The store ID - must use the tenant ID + /// The request approval ID to get create or update + /// The details to get the request plans statuses + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryRequestApproval(string privateStoreId, string requestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalProperties body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/requestApprovals/" + + global::System.Uri.EscapeDataString(requestApprovalId) + + "/query" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreQueryRequestApproval_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get request statuses foreach plan, this api is used as a complex GET action. + /// + /// The details to get the request plans statuses + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryRequestApprovalViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalProperties body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/requestApprovals/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals/{requestApprovalId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var requestApprovalId = _match.Groups["requestApprovalId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/requestApprovals/" + + requestApprovalId + + "/query" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreQueryRequestApproval_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get request statuses foreach plan, this api is used as a complex GET action. + /// + /// The details to get the request plans statuses + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryRequestApprovalViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalProperties body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/requestApprovals/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals/{requestApprovalId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var requestApprovalId = _match.Groups["requestApprovalId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/requestApprovals/" + + requestApprovalId + + "/query" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreQueryRequestApprovalWithResult_Call (request, eventListener,sender); + } + } + + /// Get request statuses foreach plan, this api is used as a complex GET action. + /// The store ID - must use the tenant ID + /// The request approval ID to get create or update + /// Json string supplied to the PrivateStoreQueryRequestApproval operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryRequestApprovalViaJsonString(string privateStoreId, string requestApprovalId, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/requestApprovals/" + + global::System.Uri.EscapeDataString(requestApprovalId) + + "/query" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreQueryRequestApproval_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Get request statuses foreach plan, this api is used as a complex GET action. + /// The store ID - must use the tenant ID + /// The request approval ID to get create or update + /// Json string supplied to the PrivateStoreQueryRequestApproval operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryRequestApprovalViaJsonStringWithResult(string privateStoreId, string requestApprovalId, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/requestApprovals/" + + global::System.Uri.EscapeDataString(requestApprovalId) + + "/query" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreQueryRequestApprovalWithResult_Call (request, eventListener,sender); + } + } + + /// Get request statuses foreach plan, this api is used as a complex GET action. + /// The store ID - must use the tenant ID + /// The request approval ID to get create or update + /// The details to get the request plans statuses + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryRequestApprovalWithResult(string privateStoreId, string requestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalProperties body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/requestApprovals/" + + global::System.Uri.EscapeDataString(requestApprovalId) + + "/query" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreQueryRequestApprovalWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreQueryRequestApprovalWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryRequestApproval.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreQueryRequestApproval_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryRequestApproval.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// The store ID - must use the tenant ID + /// The request approval ID to get create or update + /// The details to get the request plans statuses + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreQueryRequestApproval_Validate(string privateStoreId, string requestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalProperties body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(requestApprovalId),requestApprovalId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// List of user's approved offers for the provided offers and subscriptions + /// The store ID - must use the tenant ID + /// Query user's offers properties + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryUserOffers(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersProperties body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/queryUserOffers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreQueryUserOffers_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// List of user's approved offers for the provided offers and subscriptions + /// + /// Query user's offers properties + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryUserOffersViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersProperties body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/queryUserOffers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreQueryUserOffers_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// List of user's approved offers for the provided offers and subscriptions + /// + /// Query user's offers properties + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryUserOffersViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersProperties body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/queryUserOffers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreQueryUserOffersWithResult_Call (request, eventListener,sender); + } + } + + /// List of user's approved offers for the provided offers and subscriptions + /// The store ID - must use the tenant ID + /// Json string supplied to the PrivateStoreQueryUserOffers operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryUserOffersViaJsonString(string privateStoreId, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/queryUserOffers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreQueryUserOffers_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// List of user's approved offers for the provided offers and subscriptions + /// The store ID - must use the tenant ID + /// Json string supplied to the PrivateStoreQueryUserOffers operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryUserOffersViaJsonStringWithResult(string privateStoreId, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/queryUserOffers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreQueryUserOffersWithResult_Call (request, eventListener,sender); + } + } + + /// List of user's approved offers for the provided offers and subscriptions + /// The store ID - must use the tenant ID + /// Query user's offers properties + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreQueryUserOffersWithResult(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersProperties body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/queryUserOffers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreQueryUserOffersWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreQueryUserOffersWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryOffers.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreQueryUserOffers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryOffers.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -3942,109 +12567,390 @@ public partial class Marketplace } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. /// /// The store ID - must use the tenant ID + /// Query user's offers properties /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreGet_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PrivateStoreQueryUserOffers_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersProperties body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Gets the list of available private stores. - /// Determines if to use cache or DB for serving this request + /// + /// Update the admin action, weather the request is approved or rejected and the approved plans + /// + /// The store ID - must use the tenant ID + /// The admin request approval ID to get create or update + /// Admin request approval resource. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreList(string useCache, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreUpdateAdminRequestApproval(string privateStoreId, string adminRequestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.Marketplace/privateStores" + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/adminRequestApprovals/" + + global::System.Uri.EscapeDataString(adminRequestApprovalId) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - + "&" - + (string.IsNullOrEmpty(useCache) ? global::System.String.Empty : "use-cache=" + global::System.Uri.EscapeDataString(useCache)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreList_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreUpdateAdminRequestApproval_Call (request, onOk,onDefault,eventListener,sender); } } - /// Gets the list of available private stores. + /// + /// Update the admin action, weather the request is approved or rejected and the approved plans + /// /// - /// Determines if to use cache or DB for serving this request + /// Admin request approval resource. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreListViaIdentity(global::System.String viaIdentity, string useCache, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreUpdateAdminRequestApprovalViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/adminRequestApprovals/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/adminRequestApprovals/{adminRequestApprovalId}'"); } // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var adminRequestApprovalId = _match.Groups["adminRequestApprovalId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.Marketplace/privateStores" + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/adminRequestApprovals/" + + adminRequestApprovalId + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - + "&" - + (string.IsNullOrEmpty(useCache) ? global::System.String.Empty : "use-cache=" + global::System.Uri.EscapeDataString(useCache)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreUpdateAdminRequestApproval_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Update the admin action, weather the request is approved or rejected and the approved plans + /// + /// + /// Admin request approval resource. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreUpdateAdminRequestApprovalViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResource body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/adminRequestApprovals/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/adminRequestApprovals/{adminRequestApprovalId}'"); + } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var adminRequestApprovalId = _match.Groups["adminRequestApprovalId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/adminRequestApprovals/" + + adminRequestApprovalId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreUpdateAdminRequestApprovalWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Update the admin action, weather the request is approved or rejected and the approved plans + /// + /// The store ID - must use the tenant ID + /// The admin request approval ID to get create or update + /// Json string supplied to the PrivateStoreUpdateAdminRequestApproval operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreUpdateAdminRequestApprovalViaJsonString(string privateStoreId, string adminRequestApprovalId, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/adminRequestApprovals/" + + global::System.Uri.EscapeDataString(adminRequestApprovalId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreUpdateAdminRequestApproval_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// + /// Update the admin action, weather the request is approved or rejected and the approved plans + /// + /// The store ID - must use the tenant ID + /// The admin request approval ID to get create or update + /// Json string supplied to the PrivateStoreUpdateAdminRequestApproval operation + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreUpdateAdminRequestApprovalViaJsonStringWithResult(string privateStoreId, string adminRequestApprovalId, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/adminRequestApprovals/" + + global::System.Uri.EscapeDataString(adminRequestApprovalId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.PrivateStoreList_Call(request,onOk,onDefault,eventListener,sender); + return await this.PrivateStoreUpdateAdminRequestApprovalWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Update the admin action, weather the request is approved or rejected and the approved plans + /// + /// The store ID - must use the tenant ID + /// The admin request approval ID to get create or update + /// Admin request approval resource. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreUpdateAdminRequestApprovalWithResult(string privateStoreId, string adminRequestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResource body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/adminRequestApprovals/" + + global::System.Uri.EscapeDataString(adminRequestApprovalId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.PrivateStoreUpdateAdminRequestApprovalWithResult_Call (request, eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task PrivateStoreUpdateAdminRequestApprovalWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalsResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } } } - /// Actual wire call for method. + /// + /// Actual wire call for method. + /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -4054,7 +12960,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PrivateStoreUpdateAdminRequestApproval_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -4065,6 +12971,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -4072,13 +12979,13 @@ public partial class Marketplace case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStoreList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalsResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -4094,36 +13001,43 @@ public partial class Marketplace } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. /// - /// Determines if to use cache or DB for serving this request + /// The store ID - must use the tenant ID + /// The admin request approval ID to get create or update + /// Admin request approval resource. /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreList_Validate(string useCache, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PrivateStoreUpdateAdminRequestApproval_Validate(string privateStoreId, string adminRequestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResource body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { - await eventListener.AssertNotNull(nameof(useCache),useCache); + await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(adminRequestApprovalId),adminRequestApprovalId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Get map of plans and related approved subscriptions. + /// Withdraw a user request approval on specific plan /// The store ID - must use the tenant ID - /// Query approved plans payload + /// The request approval ID to get create or update + /// Withdraw properties /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreQueryApprovedPlans(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayload body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreWithdrawPlan(string privateStoreId, string requestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawProperties body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -4131,7 +13045,9 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + global::System.Uri.EscapeDataString(privateStoreId) - + "/queryApprovedPlans" + + "/requestApprovals/" + + global::System.Uri.EscapeDataString(requestApprovalId) + + "/withdrawPlan" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -4145,46 +13061,96 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreQueryApprovedPlans_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreWithdrawPlan_Call (request, onOk,onDefault,eventListener,sender); } } - /// Get map of plans and related approved subscriptions. + /// Withdraw a user request approval on specific plan /// - /// Query approved plans payload + /// Withdraw properties /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreQueryApprovedPlansViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayload body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PrivateStoreWithdrawPlanViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawProperties body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/queryApprovedPlans$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/requestApprovals/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryApprovedPlans'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals/{requestApprovalId}'"); } // replace URI parameters with values from identity var privateStoreId = _match.Groups["privateStoreId"].Value; + var requestApprovalId = _match.Groups["requestApprovalId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + privateStoreId - + "/queryApprovedPlans" + + "/requestApprovals/" + + requestApprovalId + + "/withdrawPlan" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PrivateStoreWithdrawPlan_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Withdraw a user request approval on specific plan + /// The store ID - must use the tenant ID + /// The request approval ID to get create or update + /// Json string supplied to the PrivateStoreWithdrawPlan operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task PrivateStoreWithdrawPlanViaJsonString(string privateStoreId, string requestApprovalId, global::System.String jsonString, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/requestApprovals/" + + global::System.Uri.EscapeDataString(requestApprovalId) + + "/withdrawPlan" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -4198,15 +13164,15 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreQueryApprovedPlans_Call(request,onOk,onDefault,eventListener,sender); + await this.PrivateStoreWithdrawPlan_Call (request, onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -4216,7 +13182,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreQueryApprovedPlans_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PrivateStoreWithdrawPlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -4227,6 +13193,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -4234,13 +13201,13 @@ public partial class Marketplace case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryApprovedPlansResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -4256,27 +13223,30 @@ public partial class Marketplace } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. /// /// The store ID - must use the tenant ID - /// Query approved plans payload + /// The request approval ID to get create or update + /// Withdraw properties /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreQueryApprovedPlans_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayload body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PrivateStoreWithdrawPlan_Validate(string privateStoreId, string requestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawProperties body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(requestApprovalId),requestApprovalId); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Get private store notifications state + /// Get a list of all private store rules in the given private store and collection /// The store ID - must use the tenant ID + /// The collection ID /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). @@ -4285,9 +13255,9 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreQueryNotificationsState(string privateStoreId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task QueryRules(string privateStoreId, string collectionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -4295,7 +13265,9 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + global::System.Uri.EscapeDataString(privateStoreId) - + "/queryNotificationsState" + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/queryRules" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -4309,11 +13281,11 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreQueryNotificationsState_Call(request,onOk,onDefault,eventListener,sender); + await this.QueryRules_Call (request, onOk,onDefault,eventListener,sender); } } - /// Get private store notifications state + /// Get a list of all private store rules in the given private store and collection /// /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -4323,27 +13295,30 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreQueryNotificationsStateViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task QueryRulesViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/queryNotificationsState$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryNotificationsState'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}'"); } // replace URI parameters with values from identity var privateStoreId = _match.Groups["privateStoreId"].Value; + var collectionId = _match.Groups["collectionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + privateStoreId - + "/queryNotificationsState" + + "/collections/" + + collectionId + + "/queryRules" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -4357,89 +13332,71 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreQueryNotificationsState_Call(request,onOk,onDefault,eventListener,sender); + await this.QueryRules_Call (request, onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. - /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// Get a list of all private store rules in the given private store and collection + /// /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreQueryNotificationsState_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task QueryRulesViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { + var apiVersion = @"2023-01-01"; + // Constant Parameters using( NoSynchronizationContext ) { - global::System.Net.Http.HttpResponseMessage _response = null; - try - { - var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - var _contentType = _response.Content.Headers.ContentType?.MediaType; + // verify that Identity format is an exact match for uri - switch ( _response.StatusCode ) - { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStoreNotificationsState.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}'"); } - } - } - /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. - /// - /// The store ID - must use the tenant ID - /// an instance that will receive events. - /// - /// A that will be complete when handling of the response is completed. - /// - internal async global::System.Threading.Tasks.Task PrivateStoreQueryNotificationsState_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) - { - using( NoSynchronizationContext ) - { - await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + var collectionId = _match.Groups["collectionId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/collections/" + + collectionId + + "/queryRules" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.QueryRulesWithResult_Call (request, eventListener,sender); } } - /// List of offers, regardless the collections + /// Get a list of all private store rules in the given private store and collection /// The store ID - must use the tenant ID - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// The collection ID /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreQueryOffers(string privateStoreId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task QueryRulesWithResult(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -4447,73 +13404,87 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + global::System.Uri.EscapeDataString(privateStoreId) - + "/queryOffers" + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/queryRules" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.PrivateStoreQueryOffers_Call(request,onOk,onDefault,eventListener,sender); + return await this.QueryRulesWithResult_Call (request, eventListener,sender); } } - /// List of offers, regardless the collections - /// - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreQueryOffersViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task QueryRulesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; - // Constant Parameters using( NoSynchronizationContext ) { - // verify that Identity format is an exact match for uri + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/queryOffers$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RuleListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryOffers'"); + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); } - - // replace URI parameters with values from identity - var privateStoreId = _match.Groups["privateStoreId"].Value; - // construct URL - var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.Marketplace/privateStores/" - + privateStoreId - + "/queryOffers" - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.PrivateStoreQueryOffers_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -4523,7 +13494,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreQueryOffers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task QueryRules_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -4534,6 +13505,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -4541,13 +13513,13 @@ public partial class Marketplace case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryOffers.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RuleListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -4563,37 +13535,41 @@ public partial class Marketplace } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. /// /// The store ID - must use the tenant ID + /// The collection ID /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreQueryOffers_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task QueryRules_Validate(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); + await eventListener.AssertNotNull(nameof(collectionId),collectionId); } } - /// Get request statuses foreach plan, this api is used as a complex GET action. + /// + /// All rules approved in the private store that are relevant for user subscriptions + /// /// The store ID - must use the tenant ID - /// The request approval ID to get create or update - /// The details to get the request plans statuses + /// Query user's rules properties /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreQueryRequestApproval(string privateStoreId, string requestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalProperties body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task QueryUserRules(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesProperties body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -4601,9 +13577,7 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + global::System.Uri.EscapeDataString(privateStoreId) - + "/requestApprovals/" - + global::System.Uri.EscapeDataString(requestApprovalId) - + "/query" + + "/queryUserRules" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -4617,49 +13591,49 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreQueryRequestApproval_Call(request,onOk,onDefault,eventListener,sender); + await this.QueryUserRules_Call (request, onOk,onDefault,eventListener,sender); } } - /// Get request statuses foreach plan, this api is used as a complex GET action. + /// + /// All rules approved in the private store that are relevant for user subscriptions + /// /// - /// The details to get the request plans statuses + /// Query user's rules properties /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreQueryRequestApprovalViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalProperties body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task QueryUserRulesViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesProperties body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/requestApprovals/(?[^/]+)/query$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals/{requestApprovalId}/query'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); } // replace URI parameters with values from identity var privateStoreId = _match.Groups["privateStoreId"].Value; - var requestApprovalId = _match.Groups["requestApprovalId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + privateStoreId - + "/requestApprovals/" - + requestApprovalId - + "/query" + + "/queryUserRules" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -4673,102 +13647,127 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreQueryRequestApproval_Call(request,onOk,onDefault,eventListener,sender); + await this.QueryUserRules_Call (request, onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. - /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// + /// All rules approved in the private store that are relevant for user subscriptions + /// + /// + /// Query user's rules properties /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreQueryRequestApproval_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task QueryUserRulesViaIdentityWithResult(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesProperties body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { + var apiVersion = @"2023-01-01"; + // Constant Parameters using( NoSynchronizationContext ) { - global::System.Net.Http.HttpResponseMessage _response = null; - try - { - var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - var _contentType = _response.Content.Headers.ContentType?.MediaType; + // verify that Identity format is an exact match for uri - switch ( _response.StatusCode ) - { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryRequestApproval.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - } - } - finally + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}'"); } + + // replace URI parameters with values from identity + var privateStoreId = _match.Groups["privateStoreId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + privateStoreId + + "/queryUserRules" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } + // make the call + return await this.QueryUserRulesWithResult_Call (request, eventListener,sender); } } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// All rules approved in the private store that are relevant for user subscriptions /// /// The store ID - must use the tenant ID - /// The request approval ID to get create or update - /// The details to get the request plans statuses + /// Json string supplied to the QueryUserRules operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreQueryRequestApproval_Validate(string privateStoreId, string requestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalProperties body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + public async global::System.Threading.Tasks.Task QueryUserRulesViaJsonString(string privateStoreId, global::System.String jsonString, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { + var apiVersion = @"2023-01-01"; + // Constant Parameters using( NoSynchronizationContext ) { - await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); - await eventListener.AssertNotNull(nameof(requestApprovalId),requestApprovalId); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/queryUserRules" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.QueryUserRules_Call (request, onOk,onDefault,eventListener,sender); } } /// - /// Update the admin action, weather the request is approved or rejected and the approved plans + /// All rules approved in the private store that are relevant for user subscriptions /// /// The store ID - must use the tenant ID - /// The admin request approval ID to get create or update - /// Admin request approval resource. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// Json string supplied to the QueryUserRules operation /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreUpdateAdminRequestApproval(string privateStoreId, string adminRequestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task QueryUserRulesViaJsonStringWithResult(string privateStoreId, global::System.String jsonString, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -4776,89 +13775,133 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + global::System.Uri.EscapeDataString(privateStoreId) - + "/adminRequestApprovals/" - + global::System.Uri.EscapeDataString(adminRequestApprovalId) + + "/queryUserRules" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.PrivateStoreUpdateAdminRequestApproval_Call(request,onOk,onDefault,eventListener,sender); + return await this.QueryUserRulesWithResult_Call (request, eventListener,sender); } } /// - /// Update the admin action, weather the request is approved or rejected and the approved plans + /// All rules approved in the private store that are relevant for user subscriptions /// - /// - /// Admin request approval resource. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns default (any response code not handled - /// elsewhere). + /// The store ID - must use the tenant ID + /// Query user's rules properties /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// - /// A that will be complete when handling of the response is completed. + /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreUpdateAdminRequestApprovalViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task QueryUserRulesWithResult(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesProperties body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { - // verify that Identity format is an exact match for uri - - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/adminRequestApprovals/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); - if (!_match.Success) - { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/adminRequestApprovals/{adminRequestApprovalId}'"); - } - - // replace URI parameters with values from identity - var privateStoreId = _match.Groups["privateStoreId"].Value; - var adminRequestApprovalId = _match.Groups["adminRequestApprovalId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" - + privateStoreId - + "/adminRequestApprovals/" - + adminRequestApprovalId + + global::System.Uri.EscapeDataString(privateStoreId) + + "/queryUserRules" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Put, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call - await this.PrivateStoreUpdateAdminRequestApproval_Call(request,onOk,onDefault,eventListener,sender); + return await this.QueryUserRulesWithResult_Call (request, eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task QueryUserRulesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + var sendTask = sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RuleListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + return await _result; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } + var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) ); + // Error Response : default + var code = (await _result)?.Code; + var message = (await _result)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(_response, await _result); + throw ex; + } + else + { + throw new global::System.Exception($"[{code}] : {message}"); + } + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -4868,7 +13911,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreUpdateAdminRequestApproval_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task QueryUserRules_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -4879,6 +13922,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -4886,13 +13930,13 @@ public partial class Marketplace case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AdminRequestApprovalsResource.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RuleListResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -4908,42 +13952,41 @@ public partial class Marketplace } /// - /// Validation method for method. Call this like the actual call, but - /// you will get validation events back. + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. /// /// The store ID - must use the tenant ID - /// The admin request approval ID to get create or update - /// Admin request approval resource. + /// Query user's rules properties /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreUpdateAdminRequestApproval_Validate(string privateStoreId, string adminRequestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task QueryUserRules_Validate(string privateStoreId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesProperties body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); - await eventListener.AssertNotNull(nameof(adminRequestApprovalId),adminRequestApprovalId); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Withdraw a user request approval on specific plan + /// Set rule for specific private store and collection /// The store ID - must use the tenant ID - /// The request approval ID to get create or update - /// Withdraw properties + /// The collection ID + /// /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreWithdrawPlan(string privateStoreId, string requestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawProperties body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SetCollectionRules(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequest body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -4951,9 +13994,9 @@ public partial class Marketplace var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + global::System.Uri.EscapeDataString(privateStoreId) - + "/requestApprovals/" - + global::System.Uri.EscapeDataString(requestApprovalId) - + "/withdrawPlan" + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/setRules" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -4967,49 +14010,96 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreWithdrawPlan_Call(request,onOk,onDefault,eventListener,sender); + await this.SetCollectionRules_Call (request, onOk,onDefault,eventListener,sender); } } - /// Withdraw a user request approval on specific plan + /// Set rule for specific private store and collection /// - /// Withdraw properties + /// /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// Allows the caller to choose the depth of the serialization. See . /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task PrivateStoreWithdrawPlanViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawProperties body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SetCollectionRulesViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequest body, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate|Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeUpdate) { - var apiVersion = @"2021-06-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/requestApprovals/(?[^/]+)/withdrawPlan$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Marketplace/privateStores/(?[^/]+)/collections/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals/{requestApprovalId}/withdrawPlan'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}'"); } // replace URI parameters with values from identity var privateStoreId = _match.Groups["privateStoreId"].Value; - var requestApprovalId = _match.Groups["requestApprovalId"].Value; + var collectionId = _match.Groups["collectionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/providers/Microsoft.Marketplace/privateStores/" + privateStoreId - + "/requestApprovals/" - + requestApprovalId - + "/withdrawPlan" + + "/collections/" + + collectionId + + "/setRules" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SetCollectionRules_Call (request, onOk,onDefault,eventListener,sender); + } + } + + /// Set rule for specific private store and collection + /// The store ID - must use the tenant ID + /// The collection ID + /// Json string supplied to the SetCollectionRules operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SetCollectionRulesViaJsonString(string privateStoreId, string collectionId, global::System.String jsonString, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.Marketplace/privateStores/" + + global::System.Uri.EscapeDataString(privateStoreId) + + "/collections/" + + global::System.Uri.EscapeDataString(collectionId) + + "/setRules" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -5023,15 +14113,15 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content - request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.PrivateStoreWithdrawPlan_Call(request,onOk,onDefault,eventListener,sender); + await this.SetCollectionRules_Call (request, onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). /// a delegate that is called when the remote service returns default (any response code not handled @@ -5041,7 +14131,7 @@ public partial class Marketplace /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreWithdrawPlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task SetCollectionRules_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -5052,6 +14142,7 @@ public partial class Marketplace await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -5065,7 +14156,7 @@ public partial class Marketplace default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } } @@ -5081,22 +14172,22 @@ public partial class Marketplace } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. /// /// The store ID - must use the tenant ID - /// The request approval ID to get create or update - /// Withdraw properties + /// The collection ID + /// /// an instance that will receive events. /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task PrivateStoreWithdrawPlan_Validate(string privateStoreId, string requestApprovalId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawProperties body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task SetCollectionRules_Validate(string privateStoreId, string collectionId, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequest body, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(privateStoreId),privateStoreId); - await eventListener.AssertNotNull(nameof(requestApprovalId),requestApprovalId); + await eventListener.AssertNotNull(nameof(collectionId),collectionId); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationDetails.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationDetails.PowerShell.cs similarity index 59% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationDetails.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationDetails.PowerShell.cs index 072b477f3dc5..4d5e745744d5 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationDetails.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationDetails.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class AcknowledgeOfferNotificationDetails /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class AcknowledgeOfferNotificationDetails /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,7 +55,15 @@ public partial class AcknowledgeOfferNotificationDetails partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -68,29 +78,29 @@ internal AcknowledgeOfferNotificationDetails(global::System.Collections.IDiction // actually deserialize if (content.Contains("Acknowledge")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).Acknowledge = (bool?) content.GetValueForProperty("Acknowledge",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).Acknowledge, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).Acknowledge = (bool?) content.GetValueForProperty("Acknowledge",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).Acknowledge, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("Dismiss")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).Dismiss = (bool?) content.GetValueForProperty("Dismiss",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).Dismiss, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).Dismiss = (bool?) content.GetValueForProperty("Dismiss",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).Dismiss, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("RemoveOffer")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).RemoveOffer = (bool?) content.GetValueForProperty("RemoveOffer",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).RemoveOffer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).RemoveOffer = (bool?) content.GetValueForProperty("RemoveOffer",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).RemoveOffer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("AddPlan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).AddPlan = (string[]) content.GetValueForProperty("AddPlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).AddPlan, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).AddPlan = (System.Collections.Generic.List) content.GetValueForProperty("AddPlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).AddPlan, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("RemovePlan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).RemovePlan = (string[]) content.GetValueForProperty("RemovePlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).RemovePlan, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).RemovePlan = (System.Collections.Generic.List) content.GetValueForProperty("RemovePlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).RemovePlan, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -105,51 +115,51 @@ internal AcknowledgeOfferNotificationDetails(global::System.Management.Automatio // actually deserialize if (content.Contains("Acknowledge")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).Acknowledge = (bool?) content.GetValueForProperty("Acknowledge",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).Acknowledge, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).Acknowledge = (bool?) content.GetValueForProperty("Acknowledge",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).Acknowledge, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("Dismiss")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).Dismiss = (bool?) content.GetValueForProperty("Dismiss",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).Dismiss, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).Dismiss = (bool?) content.GetValueForProperty("Dismiss",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).Dismiss, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("RemoveOffer")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).RemoveOffer = (bool?) content.GetValueForProperty("RemoveOffer",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).RemoveOffer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).RemoveOffer = (bool?) content.GetValueForProperty("RemoveOffer",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).RemoveOffer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("AddPlan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).AddPlan = (string[]) content.GetValueForProperty("AddPlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).AddPlan, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).AddPlan = (System.Collections.Generic.List) content.GetValueForProperty("AddPlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).AddPlan, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("RemovePlan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).RemovePlan = (string[]) content.GetValueForProperty("RemovePlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)this).RemovePlan, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).RemovePlan = (System.Collections.Generic.List) content.GetValueForProperty("RemovePlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)this).RemovePlan, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new AcknowledgeOfferNotificationDetails(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new AcknowledgeOfferNotificationDetails(content); } @@ -158,13 +168,27 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Notification update request payload details [System.ComponentModel.TypeConverter(typeof(AcknowledgeOfferNotificationDetailsTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationDetails.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationDetails.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationDetails.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationDetails.TypeConverter.cs index 76114ac46930..e3efa12a0c45 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationDetails.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationDetails.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class AcknowledgeOfferNotificationDetailsTypeConverter : global:: { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -76,19 +76,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -100,21 +101,21 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetails ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetails ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetails).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetails).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationDetails.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationDetails.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationDetails.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationDetails.cs index 5ecb6c44a411..fbb0ef8ead57 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationDetails.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationDetails.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Notification update request payload details public partial class AcknowledgeOfferNotificationDetails : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetails, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetails, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal { /// Backing field for property. @@ -21,11 +21,11 @@ public partial class AcknowledgeOfferNotificationDetails : public bool? Acknowledge { get => this._acknowledge; set => this._acknowledge = value; } /// Backing field for property. - private string[] _addPlan; + private System.Collections.Generic.List _addPlan; /// Gets or sets added plans [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public string[] AddPlan { get => this._addPlan; set => this._addPlan = value; } + public System.Collections.Generic.List AddPlan { get => this._addPlan; set => this._addPlan = value; } /// Backing field for property. private bool? _dismiss; @@ -42,11 +42,11 @@ public partial class AcknowledgeOfferNotificationDetails : public bool? RemoveOffer { get => this._removeOffer; set => this._removeOffer = value; } /// Backing field for property. - private string[] _removePlan; + private System.Collections.Generic.List _removePlan; /// Gets or sets remove plans [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public string[] RemovePlan { get => this._removePlan; set => this._removePlan = value; } + public System.Collections.Generic.List RemovePlan { get => this._removePlan; set => this._removePlan = value; } /// Creates an new instance. public AcknowledgeOfferNotificationDetails() @@ -62,6 +62,9 @@ public partial interface IAcknowledgeOfferNotificationDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets a value indicating whether acknowledge action flag is enabled", SerializedName = @"acknowledge", PossibleTypes = new [] { typeof(bool) })] @@ -70,14 +73,20 @@ public partial interface IAcknowledgeOfferNotificationDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets added plans", SerializedName = @"addPlans", PossibleTypes = new [] { typeof(string) })] - string[] AddPlan { get; set; } + System.Collections.Generic.List AddPlan { get; set; } /// Gets or sets a value indicating whether dismiss action flag is enabled [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets a value indicating whether dismiss action flag is enabled", SerializedName = @"dismiss", PossibleTypes = new [] { typeof(bool) })] @@ -86,6 +95,9 @@ public partial interface IAcknowledgeOfferNotificationDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets a value indicating whether remove offer action flag is enabled", SerializedName = @"removeOffer", PossibleTypes = new [] { typeof(bool) })] @@ -94,10 +106,13 @@ public partial interface IAcknowledgeOfferNotificationDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets remove plans", SerializedName = @"removePlans", PossibleTypes = new [] { typeof(string) })] - string[] RemovePlan { get; set; } + System.Collections.Generic.List RemovePlan { get; set; } } /// Notification update request payload details @@ -107,13 +122,13 @@ internal partial interface IAcknowledgeOfferNotificationDetailsInternal /// Gets or sets a value indicating whether acknowledge action flag is enabled bool? Acknowledge { get; set; } /// Gets or sets added plans - string[] AddPlan { get; set; } + System.Collections.Generic.List AddPlan { get; set; } /// Gets or sets a value indicating whether dismiss action flag is enabled bool? Dismiss { get; set; } /// Gets or sets a value indicating whether remove offer action flag is enabled bool? RemoveOffer { get; set; } /// Gets or sets remove plans - string[] RemovePlan { get; set; } + System.Collections.Generic.List RemovePlan { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationDetails.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationDetails.json.cs similarity index 85% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationDetails.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationDetails.json.cs index c38bc5dcb7bd..c4df47868378 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationDetails.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationDetails.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class AcknowledgeOfferNotificationDetails partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class AcknowledgeOfferNotificationDetails /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class AcknowledgeOfferNotificationDetails /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -63,22 +65,22 @@ internal AcknowledgeOfferNotificationDetails(Microsoft.Azure.PowerShell.Cmdlets. { return; } - {_acknowledge = If( json?.PropertyT("acknowledge"), out var __jsonAcknowledge) ? (bool?)__jsonAcknowledge : Acknowledge;} - {_dismiss = If( json?.PropertyT("dismiss"), out var __jsonDismiss) ? (bool?)__jsonDismiss : Dismiss;} - {_removeOffer = If( json?.PropertyT("removeOffer"), out var __jsonRemoveOffer) ? (bool?)__jsonRemoveOffer : RemoveOffer;} - {_addPlan = If( json?.PropertyT("addPlans"), out var __jsonAddPlans) ? If( __jsonAddPlans as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : AddPlan;} - {_removePlan = If( json?.PropertyT("removePlans"), out var __jsonRemovePlans) ? If( __jsonRemovePlans as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : RemovePlan;} + {_acknowledge = If( json?.PropertyT("acknowledge"), out var __jsonAcknowledge) ? (bool?)__jsonAcknowledge : _acknowledge;} + {_dismiss = If( json?.PropertyT("dismiss"), out var __jsonDismiss) ? (bool?)__jsonDismiss : _dismiss;} + {_removeOffer = If( json?.PropertyT("removeOffer"), out var __jsonRemoveOffer) ? (bool?)__jsonRemoveOffer : _removeOffer;} + {_addPlan = If( json?.PropertyT("addPlans"), out var __jsonAddPlans) ? If( __jsonAddPlans as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _addPlan;} + {_removePlan = If( json?.PropertyT("removePlans"), out var __jsonRemovePlans) ? If( __jsonRemovePlans as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : _removePlan;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetails. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetails. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetails. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetails. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new AcknowledgeOfferNotificationDetails(json) : null; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationProperties.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationProperties.PowerShell.cs similarity index 56% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationProperties.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationProperties.PowerShell.cs index a747013f2348..2cfd4d6394ca 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationProperties.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationProperties.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class AcknowledgeOfferNotificationProperties /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class AcknowledgeOfferNotificationProperties /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,7 +55,15 @@ public partial class AcknowledgeOfferNotificationProperties partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -68,33 +78,33 @@ internal AcknowledgeOfferNotificationProperties(global::System.Collections.IDict // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AcknowledgeOfferNotificationDetailsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AcknowledgeOfferNotificationDetailsTypeConverter.ConvertFrom); } if (content.Contains("Acknowledge")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).Acknowledge = (bool?) content.GetValueForProperty("Acknowledge",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).Acknowledge, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).Acknowledge = (bool?) content.GetValueForProperty("Acknowledge",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).Acknowledge, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("Dismiss")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).Dismiss = (bool?) content.GetValueForProperty("Dismiss",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).Dismiss, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).Dismiss = (bool?) content.GetValueForProperty("Dismiss",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).Dismiss, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("RemoveOffer")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).RemoveOffer = (bool?) content.GetValueForProperty("RemoveOffer",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).RemoveOffer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).RemoveOffer = (bool?) content.GetValueForProperty("RemoveOffer",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).RemoveOffer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("AddPlan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).AddPlan = (string[]) content.GetValueForProperty("AddPlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).AddPlan, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).AddPlan = (System.Collections.Generic.List) content.GetValueForProperty("AddPlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).AddPlan, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("RemovePlan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).RemovePlan = (string[]) content.GetValueForProperty("RemovePlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).RemovePlan, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).RemovePlan = (System.Collections.Generic.List) content.GetValueForProperty("RemovePlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).RemovePlan, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -109,55 +119,55 @@ internal AcknowledgeOfferNotificationProperties(global::System.Management.Automa // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AcknowledgeOfferNotificationDetailsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AcknowledgeOfferNotificationDetailsTypeConverter.ConvertFrom); } if (content.Contains("Acknowledge")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).Acknowledge = (bool?) content.GetValueForProperty("Acknowledge",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).Acknowledge, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).Acknowledge = (bool?) content.GetValueForProperty("Acknowledge",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).Acknowledge, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("Dismiss")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).Dismiss = (bool?) content.GetValueForProperty("Dismiss",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).Dismiss, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).Dismiss = (bool?) content.GetValueForProperty("Dismiss",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).Dismiss, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("RemoveOffer")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).RemoveOffer = (bool?) content.GetValueForProperty("RemoveOffer",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).RemoveOffer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).RemoveOffer = (bool?) content.GetValueForProperty("RemoveOffer",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).RemoveOffer, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("AddPlan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).AddPlan = (string[]) content.GetValueForProperty("AddPlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).AddPlan, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).AddPlan = (System.Collections.Generic.List) content.GetValueForProperty("AddPlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).AddPlan, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("RemovePlan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).RemovePlan = (string[]) content.GetValueForProperty("RemovePlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal)this).RemovePlan, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).RemovePlan = (System.Collections.Generic.List) content.GetValueForProperty("RemovePlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal)this).RemovePlan, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new AcknowledgeOfferNotificationProperties(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new AcknowledgeOfferNotificationProperties(content); } @@ -167,13 +177,27 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Notification update request payload [System.ComponentModel.TypeConverter(typeof(AcknowledgeOfferNotificationPropertiesTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationProperties.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationProperties.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationProperties.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationProperties.TypeConverter.cs index 8be9271868fb..16a7a5ac936a 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationProperties.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationProperties.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -15,20 +15,20 @@ public partial class AcknowledgeOfferNotificationPropertiesTypeConverter : globa { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -77,19 +77,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -101,22 +102,22 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationProperties.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationProperties.cs similarity index 63% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationProperties.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationProperties.cs index 9cb7a0026b39..40b38ba4cf27 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationProperties.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationProperties.cs @@ -3,45 +3,45 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Notification update request payload public partial class AcknowledgeOfferNotificationProperties : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationProperties, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationProperties, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal { /// Gets or sets a value indicating whether acknowledge action flag is enabled [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public bool? Acknowledge { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)Property).Acknowledge; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)Property).Acknowledge = value ?? default(bool); } + public bool? Acknowledge { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)Property).Acknowledge; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)Property).Acknowledge = value ?? default(bool); } /// Gets or sets added plans [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string[] AddPlan { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)Property).AddPlan; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)Property).AddPlan = value ?? null /* arrayOf */; } + public System.Collections.Generic.List AddPlan { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)Property).AddPlan; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)Property).AddPlan = value ?? null /* arrayOf */; } /// Gets or sets a value indicating whether dismiss action flag is enabled [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public bool? Dismiss { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)Property).Dismiss; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)Property).Dismiss = value ?? default(bool); } + public bool? Dismiss { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)Property).Dismiss; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)Property).Dismiss = value ?? default(bool); } /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetails Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationPropertiesInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AcknowledgeOfferNotificationDetails()); set { {_property = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetails Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationPropertiesInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AcknowledgeOfferNotificationDetails()); set { {_property = value;} } } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetails _property; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetails _property; /// Notification update request payload details [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetails Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AcknowledgeOfferNotificationDetails()); set => this._property = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetails Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AcknowledgeOfferNotificationDetails()); set => this._property = value; } /// Gets or sets a value indicating whether remove offer action flag is enabled [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public bool? RemoveOffer { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)Property).RemoveOffer; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)Property).RemoveOffer = value ?? default(bool); } + public bool? RemoveOffer { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)Property).RemoveOffer; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)Property).RemoveOffer = value ?? default(bool); } /// Gets or sets remove plans [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string[] RemovePlan { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)Property).RemovePlan; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetailsInternal)Property).RemovePlan = value ?? null /* arrayOf */; } + public System.Collections.Generic.List RemovePlan { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)Property).RemovePlan; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetailsInternal)Property).RemovePlan = value ?? null /* arrayOf */; } /// Creates an new instance. public AcknowledgeOfferNotificationProperties() @@ -57,6 +57,9 @@ public partial interface IAcknowledgeOfferNotificationProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets a value indicating whether acknowledge action flag is enabled", SerializedName = @"acknowledge", PossibleTypes = new [] { typeof(bool) })] @@ -65,14 +68,20 @@ public partial interface IAcknowledgeOfferNotificationProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets added plans", SerializedName = @"addPlans", PossibleTypes = new [] { typeof(string) })] - string[] AddPlan { get; set; } + System.Collections.Generic.List AddPlan { get; set; } /// Gets or sets a value indicating whether dismiss action flag is enabled [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets a value indicating whether dismiss action flag is enabled", SerializedName = @"dismiss", PossibleTypes = new [] { typeof(bool) })] @@ -81,6 +90,9 @@ public partial interface IAcknowledgeOfferNotificationProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets a value indicating whether remove offer action flag is enabled", SerializedName = @"removeOffer", PossibleTypes = new [] { typeof(bool) })] @@ -89,10 +101,13 @@ public partial interface IAcknowledgeOfferNotificationProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets remove plans", SerializedName = @"removePlans", PossibleTypes = new [] { typeof(string) })] - string[] RemovePlan { get; set; } + System.Collections.Generic.List RemovePlan { get; set; } } /// Notification update request payload @@ -102,15 +117,15 @@ internal partial interface IAcknowledgeOfferNotificationPropertiesInternal /// Gets or sets a value indicating whether acknowledge action flag is enabled bool? Acknowledge { get; set; } /// Gets or sets added plans - string[] AddPlan { get; set; } + System.Collections.Generic.List AddPlan { get; set; } /// Gets or sets a value indicating whether dismiss action flag is enabled bool? Dismiss { get; set; } /// Notification update request payload details - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationDetails Property { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationDetails Property { get; set; } /// Gets or sets a value indicating whether remove offer action flag is enabled bool? RemoveOffer { get; set; } /// Gets or sets remove plans - string[] RemovePlan { get; set; } + System.Collections.Generic.List RemovePlan { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationProperties.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationProperties.json.cs similarity index 88% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationProperties.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationProperties.json.cs index 512f83a578b0..93f46c282857 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AcknowledgeOfferNotificationProperties.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AcknowledgeOfferNotificationProperties.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class AcknowledgeOfferNotificationProperties partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class AcknowledgeOfferNotificationProperties /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class AcknowledgeOfferNotificationProperties /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -63,18 +65,18 @@ internal AcknowledgeOfferNotificationProperties(Microsoft.Azure.PowerShell.Cmdle { return; } - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AcknowledgeOfferNotificationDetails.FromJson(__jsonProperties) : Property;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AcknowledgeOfferNotificationDetails.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAcknowledgeOfferNotificationProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAcknowledgeOfferNotificationProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new AcknowledgeOfferNotificationProperties(json) : null; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalProperties.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalProperties.PowerShell.cs similarity index 51% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalProperties.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalProperties.PowerShell.cs index 4763e649817b..1bb89a4838d3 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalProperties.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalProperties.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class AdminRequestApprovalProperties /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class AdminRequestApprovalProperties /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,7 +55,15 @@ public partial class AdminRequestApprovalProperties partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -68,45 +78,49 @@ internal AdminRequestApprovalProperties(global::System.Collections.IDictionary c // actually deserialize if (content.Contains("OfferId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).OfferId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).OfferId, global::System.Convert.ToString); } if (content.Contains("DisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).DisplayName, global::System.Convert.ToString); } if (content.Contains("PublisherId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).PublisherId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).PublisherId, global::System.Convert.ToString); } if (content.Contains("AdminAction")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).AdminAction = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction?) content.GetValueForProperty("AdminAction",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).AdminAction, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).AdminAction = (string) content.GetValueForProperty("AdminAction",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).AdminAction, global::System.Convert.ToString); } if (content.Contains("ApprovedPlan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).ApprovedPlan = (string[]) content.GetValueForProperty("ApprovedPlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).ApprovedPlan, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).ApprovedPlan = (System.Collections.Generic.List) content.GetValueForProperty("ApprovedPlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).ApprovedPlan, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("Comment")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).Comment, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).Comment, global::System.Convert.ToString); } if (content.Contains("Administrator")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).Administrator = (string) content.GetValueForProperty("Administrator",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).Administrator, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).Administrator = (string) content.GetValueForProperty("Administrator",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).Administrator, global::System.Convert.ToString); } if (content.Contains("Plan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).Plan = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails[]) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).Plan, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanRequesterDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).Plan = (System.Collections.Generic.List) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).Plan, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanRequesterDetailsTypeConverter.ConvertFrom)); } if (content.Contains("CollectionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).CollectionId = (string[]) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).CollectionId = (System.Collections.Generic.List) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("Icon")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).Icon = (string) content.GetValueForProperty("Icon",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).Icon, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -121,67 +135,69 @@ internal AdminRequestApprovalProperties(global::System.Management.Automation.PSO // actually deserialize if (content.Contains("OfferId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).OfferId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).OfferId, global::System.Convert.ToString); } if (content.Contains("DisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).DisplayName, global::System.Convert.ToString); } if (content.Contains("PublisherId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).PublisherId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).PublisherId, global::System.Convert.ToString); } if (content.Contains("AdminAction")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).AdminAction = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction?) content.GetValueForProperty("AdminAction",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).AdminAction, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).AdminAction = (string) content.GetValueForProperty("AdminAction",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).AdminAction, global::System.Convert.ToString); } if (content.Contains("ApprovedPlan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).ApprovedPlan = (string[]) content.GetValueForProperty("ApprovedPlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).ApprovedPlan, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).ApprovedPlan = (System.Collections.Generic.List) content.GetValueForProperty("ApprovedPlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).ApprovedPlan, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("Comment")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).Comment, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).Comment, global::System.Convert.ToString); } if (content.Contains("Administrator")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).Administrator = (string) content.GetValueForProperty("Administrator",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).Administrator, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).Administrator = (string) content.GetValueForProperty("Administrator",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).Administrator, global::System.Convert.ToString); } if (content.Contains("Plan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).Plan = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails[]) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).Plan, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanRequesterDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).Plan = (System.Collections.Generic.List) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).Plan, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanRequesterDetailsTypeConverter.ConvertFrom)); } if (content.Contains("CollectionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).CollectionId = (string[]) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).CollectionId = (System.Collections.Generic.List) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("Icon")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).Icon = (string) content.GetValueForProperty("Icon",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)this).Icon, global::System.Convert.ToString); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new AdminRequestApprovalProperties(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new AdminRequestApprovalProperties(content); } @@ -190,13 +206,25 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Admin approval request resource properties [System.ComponentModel.TypeConverter(typeof(AdminRequestApprovalPropertiesTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalProperties.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalProperties.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalProperties.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalProperties.TypeConverter.cs index 65dc9c672106..ed83569630bd 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalProperties.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalProperties.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class AdminRequestApprovalPropertiesTypeConverter : global::Syste { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,21 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalProperties.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalProperties.cs similarity index 66% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalProperties.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalProperties.cs index b4431bd1703c..f17b964840bd 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalProperties.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalProperties.cs @@ -3,22 +3,22 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Admin approval request resource properties public partial class AdminRequestApprovalProperties : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalProperties, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalProperties, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction? _adminAction; + private string _adminAction; /// Gets or sets admin action [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction? AdminAction { get => this._adminAction; set => this._adminAction = value; } + public string AdminAction { get => this._adminAction; set => this._adminAction = value; } /// Backing field for property. private string _administrator; @@ -28,18 +28,18 @@ public partial class AdminRequestApprovalProperties : public string Administrator { get => this._administrator; set => this._administrator = value; } /// Backing field for property. - private string[] _approvedPlan; + private System.Collections.Generic.List _approvedPlan; /// Gets or sets Approved plans ids, empty in case of rejected [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public string[] ApprovedPlan { get => this._approvedPlan; set => this._approvedPlan = value; } + public System.Collections.Generic.List ApprovedPlan { get => this._approvedPlan; set => this._approvedPlan = value; } /// Backing field for property. - private string[] _collectionId; + private System.Collections.Generic.List _collectionId; /// Gets or sets list of associated collection ids [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public string[] CollectionId { get => this._collectionId; set => this._collectionId = value; } + public System.Collections.Generic.List CollectionId { get => this._collectionId; set => this._collectionId = value; } /// Backing field for property. private string _comment; @@ -55,11 +55,21 @@ public partial class AdminRequestApprovalProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] public string DisplayName { get => this._displayName; } + /// Backing field for property. + private string _icon; + + /// The offer icon url. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string Icon { get => this._icon; } + /// Internal Acessors for DisplayName - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal.DisplayName { get => this._displayName; set { {_displayName = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal.DisplayName { get => this._displayName; set { {_displayName = value;} } } + + /// Internal Acessors for Icon + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal.Icon { get => this._icon; set { {_icon = value;} } } /// Internal Acessors for Plan - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails[] Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal.Plan { get => this._plan; set { {_plan = value;} } } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal.Plan { get => this._plan; set { {_plan = value;} } } /// Backing field for property. private string _offerId; @@ -69,11 +79,11 @@ public partial class AdminRequestApprovalProperties : public string OfferId { get => this._offerId; set => this._offerId = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails[] _plan; + private System.Collections.Generic.List _plan; /// Gets list of plans with requesters details [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails[] Plan { get => this._plan; } + public System.Collections.Generic.List Plan { get => this._plan; } /// Backing field for property. private string _publisherId; @@ -96,14 +106,21 @@ public partial interface IAdminRequestApprovalProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets admin action", SerializedName = @"adminAction", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction? AdminAction { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("Approved", "Rejected")] + string AdminAction { get; set; } /// Gets or sets admin details [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets admin details", SerializedName = @"administrator", PossibleTypes = new [] { typeof(string) })] @@ -112,22 +129,31 @@ public partial interface IAdminRequestApprovalProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets Approved plans ids, empty in case of rejected", SerializedName = @"approvedPlans", PossibleTypes = new [] { typeof(string) })] - string[] ApprovedPlan { get; set; } + System.Collections.Generic.List ApprovedPlan { get; set; } /// Gets or sets list of associated collection ids [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets list of associated collection ids", SerializedName = @"collectionIds", PossibleTypes = new [] { typeof(string) })] - string[] CollectionId { get; set; } + System.Collections.Generic.List CollectionId { get; set; } /// Gets or sets admin comment [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets admin comment", SerializedName = @"comment", PossibleTypes = new [] { typeof(string) })] @@ -136,14 +162,31 @@ public partial interface IAdminRequestApprovalProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets display name", SerializedName = @"displayName", PossibleTypes = new [] { typeof(string) })] string DisplayName { get; } + /// The offer icon url. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The offer icon url.", + SerializedName = @"icon", + PossibleTypes = new [] { typeof(string) })] + string Icon { get; } /// Gets or sets offer Id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets offer Id", SerializedName = @"offerId", PossibleTypes = new [] { typeof(string) })] @@ -152,14 +195,20 @@ public partial interface IAdminRequestApprovalProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets list of plans with requesters details", SerializedName = @"plans", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails[] Plan { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetails) })] + System.Collections.Generic.List Plan { get; } /// Gets or sets publisher Id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets publisher Id", SerializedName = @"publisherId", PossibleTypes = new [] { typeof(string) })] @@ -171,21 +220,24 @@ internal partial interface IAdminRequestApprovalPropertiesInternal { /// Gets or sets admin action - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction? AdminAction { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("Approved", "Rejected")] + string AdminAction { get; set; } /// Gets or sets admin details string Administrator { get; set; } /// Gets or sets Approved plans ids, empty in case of rejected - string[] ApprovedPlan { get; set; } + System.Collections.Generic.List ApprovedPlan { get; set; } /// Gets or sets list of associated collection ids - string[] CollectionId { get; set; } + System.Collections.Generic.List CollectionId { get; set; } /// Gets or sets admin comment string Comment { get; set; } /// Gets display name string DisplayName { get; set; } + /// The offer icon url. + string Icon { get; set; } /// Gets or sets offer Id string OfferId { get; set; } /// Gets list of plans with requesters details - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails[] Plan { get; set; } + System.Collections.Generic.List Plan { get; set; } /// Gets or sets publisher Id string PublisherId { get; set; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalProperties.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalProperties.json.cs similarity index 79% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalProperties.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalProperties.json.cs index 74d6bbcc85c1..7d3e93df58b1 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalProperties.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalProperties.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class AdminRequestApprovalProperties partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class AdminRequestApprovalProperties /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class AdminRequestApprovalProperties /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -63,26 +65,27 @@ internal AdminRequestApprovalProperties(Microsoft.Azure.PowerShell.Cmdlets.Marke { return; } - {_offerId = If( json?.PropertyT("offerId"), out var __jsonOfferId) ? (string)__jsonOfferId : (string)OfferId;} - {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)DisplayName;} - {_publisherId = If( json?.PropertyT("publisherId"), out var __jsonPublisherId) ? (string)__jsonPublisherId : (string)PublisherId;} - {_adminAction = If( json?.PropertyT("adminAction"), out var __jsonAdminAction) ? (string)__jsonAdminAction : (string)AdminAction;} - {_approvedPlan = If( json?.PropertyT("approvedPlans"), out var __jsonApprovedPlans) ? If( __jsonApprovedPlans as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : ApprovedPlan;} - {_comment = If( json?.PropertyT("comment"), out var __jsonComment) ? (string)__jsonComment : (string)Comment;} - {_administrator = If( json?.PropertyT("administrator"), out var __jsonAdministrator) ? (string)__jsonAdministrator : (string)Administrator;} - {_plan = If( json?.PropertyT("plans"), out var __jsonPlans) ? If( __jsonPlans as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanRequesterDetails.FromJson(__p) )) ))() : null : Plan;} - {_collectionId = If( json?.PropertyT("collectionIds"), out var __jsonCollectionIds) ? If( __jsonCollectionIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __l) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__l, (__k)=>(string) (__k is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __j ? (string)(__j.ToString()) : null)) ))() : null : CollectionId;} + {_offerId = If( json?.PropertyT("offerId"), out var __jsonOfferId) ? (string)__jsonOfferId : (string)_offerId;} + {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)_displayName;} + {_publisherId = If( json?.PropertyT("publisherId"), out var __jsonPublisherId) ? (string)__jsonPublisherId : (string)_publisherId;} + {_adminAction = If( json?.PropertyT("adminAction"), out var __jsonAdminAction) ? (string)__jsonAdminAction : (string)_adminAction;} + {_approvedPlan = If( json?.PropertyT("approvedPlans"), out var __jsonApprovedPlans) ? If( __jsonApprovedPlans as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _approvedPlan;} + {_comment = If( json?.PropertyT("comment"), out var __jsonComment) ? (string)__jsonComment : (string)_comment;} + {_administrator = If( json?.PropertyT("administrator"), out var __jsonAdministrator) ? (string)__jsonAdministrator : (string)_administrator;} + {_plan = If( json?.PropertyT("plans"), out var __jsonPlans) ? If( __jsonPlans as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanRequesterDetails.FromJson(__p) )) ))() : null : _plan;} + {_collectionId = If( json?.PropertyT("collectionIds"), out var __jsonCollectionIds) ? If( __jsonCollectionIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __l) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__l, (__k)=>(string) (__k is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __j ? (string)(__j.ToString()) : null)) ))() : null : _collectionId;} + {_icon = If( json?.PropertyT("icon"), out var __jsonIcon) ? (string)__jsonIcon : (string)_icon;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new AdminRequestApprovalProperties(json) : null; } @@ -107,7 +110,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs return container; } AddIf( null != (((object)this._offerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._offerId.ToString()) : null, "offerId" ,container.Add ); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._displayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._displayName.ToString()) : null, "displayName" ,container.Add ); } @@ -124,7 +127,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs } AddIf( null != (((object)this._comment)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._comment.ToString()) : null, "comment" ,container.Add ); AddIf( null != (((object)this._administrator)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._administrator.ToString()) : null, "administrator" ,container.Add ); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { if (null != this._plan) { @@ -145,6 +148,10 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs } container.Add("collectionIds",__m); } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._icon)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._icon.ToString()) : null, "icon" ,container.Add ); + } AfterToJson(ref container); return container; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsList.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsList.PowerShell.cs similarity index 66% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsList.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsList.PowerShell.cs index 579ac9146e79..96275ebff864 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsList.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsList.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class AdminRequestApprovalsList /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class AdminRequestApprovalsList /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,7 +55,15 @@ public partial class AdminRequestApprovalsList partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -68,17 +78,17 @@ internal AdminRequestApprovalsList(global::System.Collections.IDictionary conten // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsListInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsListInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AdminRequestApprovalsResourceTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalsResourceTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsListInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsListInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -93,39 +103,37 @@ internal AdminRequestApprovalsList(global::System.Management.Automation.PSObject // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsListInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsListInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AdminRequestApprovalsResourceTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalsResourceTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsListInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsListInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsList DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsList DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new AdminRequestApprovalsList(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new AdminRequestApprovalsList(content); } @@ -134,13 +142,25 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// List of admin request approval resources [System.ComponentModel.TypeConverter(typeof(AdminRequestApprovalsListTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsList.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsList.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsList.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsList.TypeConverter.cs index ef78e14510eb..fa0e9aed0450 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsList.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsList.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class AdminRequestApprovalsListTypeConverter : global::System.Man { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsList ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsList ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsList).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsList).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsList.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsList.cs similarity index 68% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsList.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsList.cs index c780cc11d284..a37a9316e3e9 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsList.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsList.cs @@ -3,18 +3,18 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// List of admin request approval resources public partial class AdminRequestApprovalsList : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsList, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsListInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsList, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsListInternal { /// Internal Acessors for NextLink - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsListInternal.NextLink { get => this._nextLink; set { {_nextLink = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsListInternal.NextLink { get => this._nextLink; set { {_nextLink = value;} } } /// Backing field for property. private string _nextLink; @@ -24,10 +24,10 @@ public partial class AdminRequestApprovalsList : public string NextLink { get => this._nextLink; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource[] _value; + private System.Collections.Generic.List _value; [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource[] Value { get => this._value; set => this._value = value; } + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } /// Creates an new instance. public AdminRequestApprovalsList() @@ -43,6 +43,9 @@ public partial interface IAdminRequestApprovalsList : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"URL to get the next set of notifications list results if there are any.", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -51,10 +54,13 @@ public partial interface IAdminRequestApprovalsList : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource[] Value { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResource) })] + System.Collections.Generic.List Value { get; set; } } /// List of admin request approval resources @@ -64,7 +70,7 @@ internal partial interface IAdminRequestApprovalsListInternal /// URL to get the next set of notifications list results if there are any. string NextLink { get; set; } - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsList.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsList.json.cs similarity index 84% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsList.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsList.json.cs index 09881b383f34..5d08594cae7e 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsList.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsList.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class AdminRequestApprovalsList partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class AdminRequestApprovalsList /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class AdminRequestApprovalsList /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -63,19 +65,19 @@ internal AdminRequestApprovalsList(Microsoft.Azure.PowerShell.Cmdlets.Marketplac { return; } - {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AdminRequestApprovalsResource.FromJson(__u) )) ))() : null : Value;} - {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResource) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalsResource.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsList. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsList. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsList. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsList. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsList FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsList FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new AdminRequestApprovalsList(json) : null; } @@ -108,7 +110,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs } container.Add("value",__w); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsResource.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsResource.PowerShell.cs new file mode 100644 index 000000000000..fdb8c3dc2cf9 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsResource.PowerShell.cs @@ -0,0 +1,324 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// Admin request approval resource. + [System.ComponentModel.TypeConverter(typeof(AdminRequestApprovalsResourceTypeConverter))] + public partial class AdminRequestApprovalsResource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AdminRequestApprovalsResource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("AdminAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).AdminAction = (string) content.GetValueForProperty("AdminAction",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).AdminAction, global::System.Convert.ToString); + } + if (content.Contains("OfferId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).OfferId, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("PublisherId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).PublisherId, global::System.Convert.ToString); + } + if (content.Contains("ApprovedPlan")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).ApprovedPlan = (System.Collections.Generic.List) content.GetValueForProperty("ApprovedPlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).ApprovedPlan, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Comment, global::System.Convert.ToString); + } + if (content.Contains("Administrator")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Administrator = (string) content.GetValueForProperty("Administrator",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Administrator, global::System.Convert.ToString); + } + if (content.Contains("Plan")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Plan = (System.Collections.Generic.List) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Plan, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanRequesterDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("CollectionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).CollectionId = (System.Collections.Generic.List) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("Icon")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Icon = (string) content.GetValueForProperty("Icon",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Icon, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AdminRequestApprovalsResource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("AdminAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).AdminAction = (string) content.GetValueForProperty("AdminAction",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).AdminAction, global::System.Convert.ToString); + } + if (content.Contains("OfferId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).OfferId, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("PublisherId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).PublisherId, global::System.Convert.ToString); + } + if (content.Contains("ApprovedPlan")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).ApprovedPlan = (System.Collections.Generic.List) content.GetValueForProperty("ApprovedPlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).ApprovedPlan, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("Comment")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Comment, global::System.Convert.ToString); + } + if (content.Contains("Administrator")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Administrator = (string) content.GetValueForProperty("Administrator",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Administrator, global::System.Convert.ToString); + } + if (content.Contains("Plan")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Plan = (System.Collections.Generic.List) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Plan, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanRequesterDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("CollectionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).CollectionId = (System.Collections.Generic.List) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("Icon")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Icon = (string) content.GetValueForProperty("Icon",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal)this).Icon, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AdminRequestApprovalsResource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AdminRequestApprovalsResource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Admin request approval resource. + [System.ComponentModel.TypeConverter(typeof(AdminRequestApprovalsResourceTypeConverter))] + public partial interface IAdminRequestApprovalsResource + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsResource.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsResource.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsResource.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsResource.TypeConverter.cs index 74ab263c068c..ef8cc44343d3 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsResource.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsResource.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class AdminRequestApprovalsResourceTypeConverter : global::System { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResource ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResource).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsResource.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsResource.cs similarity index 51% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsResource.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsResource.cs index 1d4cb5d5f8eb..c1e1ccee6439 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsResource.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsResource.cs @@ -3,125 +3,135 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Admin request approval resource. public partial class AdminRequestApprovalsResource : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResource, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IValidates { /// - /// Backing field for Inherited model + /// Backing field for Inherited model /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Resource(); + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Resource(); /// Gets or sets admin action [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction? AdminAction { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).AdminAction; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).AdminAction = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction)""); } + public string AdminAction { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).AdminAction; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).AdminAction = value ?? null; } /// Gets or sets admin details [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string Administrator { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).Administrator; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).Administrator = value ?? null; } + public string Administrator { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).Administrator; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).Administrator = value ?? null; } /// Gets or sets Approved plans ids, empty in case of rejected [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string[] ApprovedPlan { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).ApprovedPlan; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).ApprovedPlan = value ?? null /* arrayOf */; } + public System.Collections.Generic.List ApprovedPlan { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).ApprovedPlan; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).ApprovedPlan = value ?? null /* arrayOf */; } /// Gets or sets list of associated collection ids [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string[] CollectionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).CollectionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).CollectionId = value ?? null /* arrayOf */; } + public System.Collections.Generic.List CollectionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).CollectionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).CollectionId = value ?? null /* arrayOf */; } /// Gets or sets admin comment [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string Comment { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).Comment; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).Comment = value ?? null; } + public string Comment { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).Comment; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).Comment = value ?? null; } /// Gets display name [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).DisplayName; } + public string DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).DisplayName; } + + /// The offer icon url. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public string Icon { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).Icon; } /// The resource ID. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Id; } + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Id; } /// Internal Acessors for DisplayName - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal.DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).DisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).DisplayName = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal.DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).DisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).DisplayName = value; } + + /// Internal Acessors for Icon + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal.Icon { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).Icon; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).Icon = value; } /// Internal Acessors for Plan - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails[] Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal.Plan { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).Plan; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).Plan = value; } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal.Plan { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).Plan; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).Plan = value; } /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalProperties Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AdminRequestApprovalProperties()); set { {_property = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalProperties Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResourceInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalProperties()); set { {_property = value;} } } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Id = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Id = value; } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Name = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Name = value; } /// Internal Acessors for SystemData - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemData = value; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemData = value; } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Type = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Type = value; } /// The name of the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Name; } + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Name; } /// Gets or sets offer Id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string OfferId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).OfferId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).OfferId = value ?? null; } + public string OfferId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).OfferId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).OfferId = value ?? null; } /// Gets list of plans with requesters details [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails[] Plan { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).Plan; } + public System.Collections.Generic.List Plan { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).Plan; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalProperties _property; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalProperties _property; /// The privateStore admin Approval request data structure. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AdminRequestApprovalProperties()); set => this._property = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalProperties()); set => this._property = value; } /// Gets or sets publisher Id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string PublisherId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).PublisherId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalPropertiesInternal)Property).PublisherId = value ?? null; } + public string PublisherId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).PublisherId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalPropertiesInternal)Property).PublisherId = value ?? null; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } /// Metadata pertaining to creation and last modification of the resource [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemData; } + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemData; } /// The timestamp of resource creation (UTC) [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } /// The identity that created the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedBy = value ?? null; } + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedBy = value ?? null; } /// The type of identity that created the resource [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType)""); } + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedByType = value ?? null; } /// The timestamp of resource last modification (UTC) [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } /// The identity that last modified the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedBy = value ?? null; } + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedBy = value ?? null; } /// The type of identity that last modified the resource [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType)""); } + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedByType = value ?? null; } /// The type of the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Type; } + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Type; } /// Creates an new instance. public AdminRequestApprovalsResource() @@ -133,7 +143,7 @@ public AdminRequestApprovalsResource() /// an instance that will receive validation /// events. /// - /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// A that will be complete when validation is completed. /// public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { @@ -144,20 +154,27 @@ public AdminRequestApprovalsResource() /// Admin request approval resource. public partial interface IAdminRequestApprovalsResource : Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResource + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResource { /// Gets or sets admin action [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets admin action", SerializedName = @"adminAction", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction? AdminAction { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("Approved", "Rejected")] + string AdminAction { get; set; } /// Gets or sets admin details [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets admin details", SerializedName = @"administrator", PossibleTypes = new [] { typeof(string) })] @@ -166,22 +183,31 @@ public partial interface IAdminRequestApprovalsResource : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets Approved plans ids, empty in case of rejected", SerializedName = @"approvedPlans", PossibleTypes = new [] { typeof(string) })] - string[] ApprovedPlan { get; set; } + System.Collections.Generic.List ApprovedPlan { get; set; } /// Gets or sets list of associated collection ids [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets list of associated collection ids", SerializedName = @"collectionIds", PossibleTypes = new [] { typeof(string) })] - string[] CollectionId { get; set; } + System.Collections.Generic.List CollectionId { get; set; } /// Gets or sets admin comment [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets admin comment", SerializedName = @"comment", PossibleTypes = new [] { typeof(string) })] @@ -190,14 +216,31 @@ public partial interface IAdminRequestApprovalsResource : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets display name", SerializedName = @"displayName", PossibleTypes = new [] { typeof(string) })] string DisplayName { get; } + /// The offer icon url. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The offer icon url.", + SerializedName = @"icon", + PossibleTypes = new [] { typeof(string) })] + string Icon { get; } /// Gets or sets offer Id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets offer Id", SerializedName = @"offerId", PossibleTypes = new [] { typeof(string) })] @@ -206,14 +249,20 @@ public partial interface IAdminRequestApprovalsResource : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets list of plans with requesters details", SerializedName = @"plans", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails[] Plan { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetails) })] + System.Collections.Generic.List Plan { get; } /// Gets or sets publisher Id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets publisher Id", SerializedName = @"publisherId", PossibleTypes = new [] { typeof(string) })] @@ -222,26 +271,29 @@ public partial interface IAdminRequestApprovalsResource : } /// Admin request approval resource. internal partial interface IAdminRequestApprovalsResourceInternal : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal { /// Gets or sets admin action - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction? AdminAction { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("Approved", "Rejected")] + string AdminAction { get; set; } /// Gets or sets admin details string Administrator { get; set; } /// Gets or sets Approved plans ids, empty in case of rejected - string[] ApprovedPlan { get; set; } + System.Collections.Generic.List ApprovedPlan { get; set; } /// Gets or sets list of associated collection ids - string[] CollectionId { get; set; } + System.Collections.Generic.List CollectionId { get; set; } /// Gets or sets admin comment string Comment { get; set; } /// Gets display name string DisplayName { get; set; } + /// The offer icon url. + string Icon { get; set; } /// Gets or sets offer Id string OfferId { get; set; } /// Gets list of plans with requesters details - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails[] Plan { get; set; } + System.Collections.Generic.List Plan { get; set; } /// The privateStore admin Approval request data structure. - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalProperties Property { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalProperties Property { get; set; } /// Gets or sets publisher Id string PublisherId { get; set; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsResource.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsResource.json.cs similarity index 87% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsResource.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsResource.json.cs index 68a8e91ffb9c..dd36f0195c5c 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsResource.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AdminRequestApprovalsResource.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class AdminRequestApprovalsResource partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class AdminRequestApprovalsResource /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class AdminRequestApprovalsResource /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -63,19 +65,19 @@ internal AdminRequestApprovalsResource(Microsoft.Azure.PowerShell.Cmdlets.Market { return; } - __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Resource(json); - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AdminRequestApprovalProperties.FromJson(__jsonProperties) : Property;} + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AdminRequestApprovalProperties.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResource. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResource. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAdminRequestApprovalsResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new AdminRequestApprovalsResource(json) : null; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Any.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Any.PowerShell.cs index 109a3bec89af..d004c5634c34 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Any.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Any.PowerShell.cs @@ -7,7 +7,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; - /// Any object + /// Anything [System.ComponentModel.TypeConverter(typeof(AnyTypeConverter))] public partial class Any { @@ -31,7 +31,8 @@ public partial class Any /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class Any /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -52,6 +54,14 @@ public partial class Any partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + /// /// Deserializes a into a new instance of . @@ -116,15 +126,27 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAny Deseria /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. + /// an instance of the model class. public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAny FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } - /// Any object + /// Anything [System.ComponentModel.TypeConverter(typeof(AnyTypeConverter))] public partial interface IAny diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Any.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Any.TypeConverter.cs index d55408de62e5..eeed4af2e3dd 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Any.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Any.TypeConverter.cs @@ -14,20 +14,19 @@ public partial class AnyTypeConverter : global::System.Management.Automation.PST { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +74,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,8 +99,7 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Any.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Any.cs index a4f27c8ba854..fce050f0dbf4 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Any.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Any.cs @@ -7,7 +7,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; - /// Any object + /// Anything public partial class Any : Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAny, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyInternal @@ -19,13 +19,13 @@ public Any() } } - /// Any object + /// Anything public partial interface IAny : Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable { } - /// Any object + /// Anything internal partial interface IAnyInternal { diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Any.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Any.json.cs index 60bdc187ff44..0b98c6a660d2 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Any.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Any.json.cs @@ -7,7 +7,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; - /// Any object + /// Anything public partial class Any { @@ -20,7 +20,7 @@ public partial class Any partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class Any /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class Any /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/AnyExistingOffersInTheCollectionsResponse.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AnyExistingOffersInTheCollectionsResponse.PowerShell.cs new file mode 100644 index 000000000000..5000b0a8bd9a --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AnyExistingOffersInTheCollectionsResponse.PowerShell.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// Response object of query if are there existing offers in the collections. + [System.ComponentModel.TypeConverter(typeof(AnyExistingOffersInTheCollectionsResponseTypeConverter))] + public partial class AnyExistingOffersInTheCollectionsResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal AnyExistingOffersInTheCollectionsResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponseInternal)this).Value = (bool?) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponseInternal)this).Value, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AnyExistingOffersInTheCollectionsResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponseInternal)this).Value = (bool?) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponseInternal)this).Value, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AnyExistingOffersInTheCollectionsResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AnyExistingOffersInTheCollectionsResponse(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Response object of query if are there existing offers in the collections. + [System.ComponentModel.TypeConverter(typeof(AnyExistingOffersInTheCollectionsResponseTypeConverter))] + public partial interface IAnyExistingOffersInTheCollectionsResponse + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/AnyExistingOffersInTheCollectionsResponse.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AnyExistingOffersInTheCollectionsResponse.TypeConverter.cs new file mode 100644 index 000000000000..3fe84a426402 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AnyExistingOffersInTheCollectionsResponse.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AnyExistingOffersInTheCollectionsResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AnyExistingOffersInTheCollectionsResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AnyExistingOffersInTheCollectionsResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AnyExistingOffersInTheCollectionsResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/AnyExistingOffersInTheCollectionsResponse.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AnyExistingOffersInTheCollectionsResponse.cs new file mode 100644 index 000000000000..baba849a3586 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AnyExistingOffersInTheCollectionsResponse.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Response object of query if are there existing offers in the collections. + public partial class AnyExistingOffersInTheCollectionsResponse : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponseInternal + { + + /// Backing field for property. + private bool? _value; + + /// + /// Boolean answer, true if exists at least a single offer in an enabled collection, otherwise, false. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public bool? Value { get => this._value; set => this._value = value; } + + /// + /// Creates an new instance. + /// + public AnyExistingOffersInTheCollectionsResponse() + { + + } + } + /// Response object of query if are there existing offers in the collections. + public partial interface IAnyExistingOffersInTheCollectionsResponse : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + /// + /// Boolean answer, true if exists at least a single offer in an enabled collection, otherwise, false. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Boolean answer, true if exists at least a single offer in an enabled collection, otherwise, false.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(bool) })] + bool? Value { get; set; } + + } + /// Response object of query if are there existing offers in the collections. + internal partial interface IAnyExistingOffersInTheCollectionsResponseInternal + + { + /// + /// Boolean answer, true if exists at least a single offer in an enabled collection, otherwise, false. + /// + bool? Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/AnyExistingOffersInTheCollectionsResponse.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AnyExistingOffersInTheCollectionsResponse.json.cs new file mode 100644 index 000000000000..508f6036697a --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/AnyExistingOffersInTheCollectionsResponse.json.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Response object of query if are there existing offers in the collections. + public partial class AnyExistingOffersInTheCollectionsResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal AnyExistingOffersInTheCollectionsResponse(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? (bool?)__jsonValue : _value;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new AnyExistingOffersInTheCollectionsResponse(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._value ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonBoolean((bool)this._value) : null, "value" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsResource.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsResource.PowerShell.cs deleted file mode 100644 index a2e0bbb3a0a7..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/AdminRequestApprovalsResource.PowerShell.cs +++ /dev/null @@ -1,296 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 -{ - using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; - - /// Admin request approval resource. - [System.ComponentModel.TypeConverter(typeof(AdminRequestApprovalsResourceTypeConverter))] - public partial class AdminRequestApprovalsResource - { - - /// - /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the - /// object before it is returned. Implement this method in a partial class to enable this behavior - /// - /// The global::System.Collections.IDictionary content that should be used. - - partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); - - /// - /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object - /// before it is returned. Implement this method in a partial class to enable this behavior - /// - /// The global::System.Management.Automation.PSObject content that should be used. - - partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); - - /// - /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization - /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. - /// Implement this method in a partial class to enable this behavior. - /// - /// The global::System.Collections.IDictionary content that should be used. - /// Determines if the rest of the serialization should be processed, or if the method should return - /// instantly. - - partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); - - /// - /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization - /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. - /// Implement this method in a partial class to enable this behavior. - /// - /// The global::System.Management.Automation.PSObject content that should be used. - /// Determines if the rest of the serialization should be processed, or if the method should return - /// instantly. - - partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); - - /// - /// Deserializes a into a new instance of . - /// - /// The global::System.Collections.IDictionary content that should be used. - internal AdminRequestApprovalsResource(global::System.Collections.IDictionary content) - { - bool returnNow = false; - BeforeDeserializeDictionary(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("Property")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AdminRequestApprovalPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("SystemDataCreatedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataCreatedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemDataCreatedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataLastModifiedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemData")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SystemDataTypeConverter.ConvertFrom); - } - if (content.Contains("Id")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id, global::System.Convert.ToString); - } - if (content.Contains("Name")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name, global::System.Convert.ToString); - } - if (content.Contains("Type")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type, global::System.Convert.ToString); - } - if (content.Contains("AdminAction")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).AdminAction = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction?) content.GetValueForProperty("AdminAction",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).AdminAction, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction.CreateFrom); - } - if (content.Contains("OfferId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).OfferId, global::System.Convert.ToString); - } - if (content.Contains("DisplayName")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).DisplayName, global::System.Convert.ToString); - } - if (content.Contains("PublisherId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).PublisherId, global::System.Convert.ToString); - } - if (content.Contains("ApprovedPlan")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).ApprovedPlan = (string[]) content.GetValueForProperty("ApprovedPlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).ApprovedPlan, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); - } - if (content.Contains("Comment")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).Comment, global::System.Convert.ToString); - } - if (content.Contains("Administrator")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).Administrator = (string) content.GetValueForProperty("Administrator",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).Administrator, global::System.Convert.ToString); - } - if (content.Contains("Plan")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).Plan = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails[]) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).Plan, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanRequesterDetailsTypeConverter.ConvertFrom)); - } - if (content.Contains("CollectionId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).CollectionId = (string[]) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); - } - AfterDeserializeDictionary(content); - } - - /// - /// Deserializes a into a new instance of . - /// - /// The global::System.Management.Automation.PSObject content that should be used. - internal AdminRequestApprovalsResource(global::System.Management.Automation.PSObject content) - { - bool returnNow = false; - BeforeDeserializePSObject(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("Property")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.AdminRequestApprovalPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("SystemDataCreatedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataCreatedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemDataCreatedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataLastModifiedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemData")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SystemDataTypeConverter.ConvertFrom); - } - if (content.Contains("Id")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id, global::System.Convert.ToString); - } - if (content.Contains("Name")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name, global::System.Convert.ToString); - } - if (content.Contains("Type")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type, global::System.Convert.ToString); - } - if (content.Contains("AdminAction")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).AdminAction = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction?) content.GetValueForProperty("AdminAction",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).AdminAction, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction.CreateFrom); - } - if (content.Contains("OfferId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).OfferId, global::System.Convert.ToString); - } - if (content.Contains("DisplayName")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).DisplayName, global::System.Convert.ToString); - } - if (content.Contains("PublisherId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).PublisherId, global::System.Convert.ToString); - } - if (content.Contains("ApprovedPlan")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).ApprovedPlan = (string[]) content.GetValueForProperty("ApprovedPlan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).ApprovedPlan, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); - } - if (content.Contains("Comment")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).Comment, global::System.Convert.ToString); - } - if (content.Contains("Administrator")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).Administrator = (string) content.GetValueForProperty("Administrator",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).Administrator, global::System.Convert.ToString); - } - if (content.Contains("Plan")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).Plan = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails[]) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).Plan, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanRequesterDetailsTypeConverter.ConvertFrom)); - } - if (content.Contains("CollectionId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).CollectionId = (string[]) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResourceInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); - } - AfterDeserializePSObject(content); - } - - /// - /// Deserializes a into an instance of . - /// - /// The global::System.Collections.IDictionary content that should be used. - /// - /// an instance of . - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource DeserializeFromDictionary(global::System.Collections.IDictionary content) - { - return new AdminRequestApprovalsResource(content); - } - - /// - /// Deserializes a into an instance of . - /// - /// The global::System.Management.Automation.PSObject content that should be used. - /// - /// an instance of . - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) - { - return new AdminRequestApprovalsResource(content); - } - - /// - /// Creates a new instance of , deserializing the content from a json string. - /// - /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IAdminRequestApprovalsResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); - - /// Serializes this instance to a json string. - - /// a containing this model serialized to JSON text. - public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); - } - /// Admin request approval resource. - [System.ComponentModel.TypeConverter(typeof(AdminRequestApprovalsResourceTypeConverter))] - public partial interface IAdminRequestApprovalsResource - - { - - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Collection.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Collection.PowerShell.cs deleted file mode 100644 index ee443495d128..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Collection.PowerShell.cs +++ /dev/null @@ -1,278 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 -{ - using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; - - /// The Collection data structure. - [System.ComponentModel.TypeConverter(typeof(CollectionTypeConverter))] - public partial class Collection - { - - /// - /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the - /// object before it is returned. Implement this method in a partial class to enable this behavior - /// - /// The global::System.Collections.IDictionary content that should be used. - - partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); - - /// - /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object - /// before it is returned. Implement this method in a partial class to enable this behavior - /// - /// The global::System.Management.Automation.PSObject content that should be used. - - partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); - - /// - /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization - /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. - /// Implement this method in a partial class to enable this behavior. - /// - /// The global::System.Collections.IDictionary content that should be used. - /// Determines if the rest of the serialization should be processed, or if the method should return - /// instantly. - - partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); - - /// - /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization - /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. - /// Implement this method in a partial class to enable this behavior. - /// - /// The global::System.Management.Automation.PSObject content that should be used. - /// Determines if the rest of the serialization should be processed, or if the method should return - /// instantly. - - partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); - - /// - /// Deserializes a into a new instance of . - /// - /// The global::System.Collections.IDictionary content that should be used. - internal Collection(global::System.Collections.IDictionary content) - { - bool returnNow = false; - BeforeDeserializeDictionary(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("Property")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("SystemDataCreatedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataCreatedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemDataCreatedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataLastModifiedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemData")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SystemDataTypeConverter.ConvertFrom); - } - if (content.Contains("Id")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id, global::System.Convert.ToString); - } - if (content.Contains("Name")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name, global::System.Convert.ToString); - } - if (content.Contains("Type")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type, global::System.Convert.ToString); - } - if (content.Contains("CollectionId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).CollectionId = (string) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).CollectionId, global::System.Convert.ToString); - } - if (content.Contains("CollectionName")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).CollectionName = (string) content.GetValueForProperty("CollectionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).CollectionName, global::System.Convert.ToString); - } - if (content.Contains("Claim")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).Claim = (string) content.GetValueForProperty("Claim",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).Claim, global::System.Convert.ToString); - } - if (content.Contains("AllSubscription")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).AllSubscription = (bool?) content.GetValueForProperty("AllSubscription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).AllSubscription, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); - } - if (content.Contains("SubscriptionsList")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).SubscriptionsList = (string[]) content.GetValueForProperty("SubscriptionsList",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).SubscriptionsList, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); - } - if (content.Contains("Enabled")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); - } - if (content.Contains("NumberOfOffer")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).NumberOfOffer = (long?) content.GetValueForProperty("NumberOfOffer",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).NumberOfOffer, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); - } - AfterDeserializeDictionary(content); - } - - /// - /// Deserializes a into a new instance of . - /// - /// The global::System.Management.Automation.PSObject content that should be used. - internal Collection(global::System.Management.Automation.PSObject content) - { - bool returnNow = false; - BeforeDeserializePSObject(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("Property")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("SystemDataCreatedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataCreatedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemDataCreatedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataLastModifiedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemData")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SystemDataTypeConverter.ConvertFrom); - } - if (content.Contains("Id")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id, global::System.Convert.ToString); - } - if (content.Contains("Name")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name, global::System.Convert.ToString); - } - if (content.Contains("Type")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type, global::System.Convert.ToString); - } - if (content.Contains("CollectionId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).CollectionId = (string) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).CollectionId, global::System.Convert.ToString); - } - if (content.Contains("CollectionName")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).CollectionName = (string) content.GetValueForProperty("CollectionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).CollectionName, global::System.Convert.ToString); - } - if (content.Contains("Claim")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).Claim = (string) content.GetValueForProperty("Claim",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).Claim, global::System.Convert.ToString); - } - if (content.Contains("AllSubscription")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).AllSubscription = (bool?) content.GetValueForProperty("AllSubscription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).AllSubscription, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); - } - if (content.Contains("SubscriptionsList")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).SubscriptionsList = (string[]) content.GetValueForProperty("SubscriptionsList",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).SubscriptionsList, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); - } - if (content.Contains("Enabled")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); - } - if (content.Contains("NumberOfOffer")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).NumberOfOffer = (long?) content.GetValueForProperty("NumberOfOffer",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal)this).NumberOfOffer, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); - } - AfterDeserializePSObject(content); - } - - /// - /// Deserializes a into an instance of . - /// - /// The global::System.Collections.IDictionary content that should be used. - /// - /// an instance of . - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection DeserializeFromDictionary(global::System.Collections.IDictionary content) - { - return new Collection(content); - } - - /// - /// Deserializes a into an instance of . - /// - /// The global::System.Management.Automation.PSObject content that should be used. - /// - /// an instance of . - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) - { - return new Collection(content); - } - - /// - /// Creates a new instance of , deserializing the content from a json string. - /// - /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); - - /// Serializes this instance to a json string. - - /// a containing this model serialized to JSON text. - public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); - } - /// The Collection data structure. - [System.ComponentModel.TypeConverter(typeof(CollectionTypeConverter))] - public partial interface ICollection - - { - - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Collection.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Collection.cs deleted file mode 100644 index 062aa9d76735..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Collection.cs +++ /dev/null @@ -1,230 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 -{ - using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; - - /// The Collection data structure. - public partial class Collection : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IValidates - { - /// - /// Backing field for Inherited model - /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Resource(); - - /// Indicating whether all subscriptions are selected (=true) or not (=false). - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public bool? AllSubscription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)Property).AllSubscription; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)Property).AllSubscription = value ?? default(bool); } - - /// Gets or sets the association with Commercial's Billing Account. - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string Claim { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)Property).Claim; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)Property).Claim = value ?? null; } - - /// Gets collection Id. - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string CollectionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)Property).CollectionId; } - - /// Gets or sets collection name. - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string CollectionName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)Property).CollectionName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)Property).CollectionName = value ?? null; } - - /// Indicating whether the collection is enabled or disabled. - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public bool? Enabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)Property).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)Property).Enabled = value ?? default(bool); } - - /// The resource ID. - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Id; } - - /// Internal Acessors for CollectionId - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal.CollectionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)Property).CollectionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)Property).CollectionId = value; } - - /// Internal Acessors for NumberOfOffer - long? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal.NumberOfOffer { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)Property).NumberOfOffer; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)Property).NumberOfOffer = value; } - - /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionProperties Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionProperties()); set { {_property = value;} } } - - /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Id = value; } - - /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Name = value; } - - /// Internal Acessors for SystemData - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemData = value; } - - /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Type = value; } - - /// The name of the resource. - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Name; } - - /// Gets the number of offers associated with the collection. - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public long? NumberOfOffer { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)Property).NumberOfOffer; } - - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionProperties _property; - - /// The collection data structure. - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionProperties()); set => this._property = value; } - - /// - /// Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, - /// explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request - /// - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string[] SubscriptionsList { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)Property).SubscriptionsList; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)Property).SubscriptionsList = value ?? null /* arrayOf */; } - - /// Metadata pertaining to creation and last modification of the resource - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemData; } - - /// The timestamp of resource creation (UTC) - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } - - /// The identity that created the resource. - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedBy = value ?? null; } - - /// The type of identity that created the resource - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType)""); } - - /// The timestamp of resource last modification (UTC) - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } - - /// The identity that last modified the resource. - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedBy = value ?? null; } - - /// The type of identity that last modified the resource - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType)""); } - - /// The type of the resource. - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Type; } - - /// Creates an new instance. - public Collection() - { - - } - - /// Validates that this object meets the validation criteria. - /// an instance that will receive validation - /// events. - /// - /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. - /// - public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) - { - await eventListener.AssertNotNull(nameof(__resource), __resource); - await eventListener.AssertObjectIsValid(nameof(__resource), __resource); - } - } - /// The Collection data structure. - public partial interface ICollection : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResource - { - /// Indicating whether all subscriptions are selected (=true) or not (=false). - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"Indicating whether all subscriptions are selected (=true) or not (=false).", - SerializedName = @"allSubscriptions", - PossibleTypes = new [] { typeof(bool) })] - bool? AllSubscription { get; set; } - /// Gets or sets the association with Commercial's Billing Account. - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"Gets or sets the association with Commercial's Billing Account.", - SerializedName = @"claim", - PossibleTypes = new [] { typeof(string) })] - string Claim { get; set; } - /// Gets collection Id. - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( - Required = false, - ReadOnly = true, - Description = @"Gets collection Id.", - SerializedName = @"collectionId", - PossibleTypes = new [] { typeof(string) })] - string CollectionId { get; } - /// Gets or sets collection name. - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"Gets or sets collection name.", - SerializedName = @"collectionName", - PossibleTypes = new [] { typeof(string) })] - string CollectionName { get; set; } - /// Indicating whether the collection is enabled or disabled. - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"Indicating whether the collection is enabled or disabled.", - SerializedName = @"enabled", - PossibleTypes = new [] { typeof(bool) })] - bool? Enabled { get; set; } - /// Gets the number of offers associated with the collection. - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( - Required = false, - ReadOnly = true, - Description = @"Gets the number of offers associated with the collection.", - SerializedName = @"numberOfOffers", - PossibleTypes = new [] { typeof(long) })] - long? NumberOfOffer { get; } - /// - /// Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, - /// explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request - /// - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request", - SerializedName = @"subscriptionsList", - PossibleTypes = new [] { typeof(string) })] - string[] SubscriptionsList { get; set; } - - } - /// The Collection data structure. - internal partial interface ICollectionInternal : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal - { - /// Indicating whether all subscriptions are selected (=true) or not (=false). - bool? AllSubscription { get; set; } - /// Gets or sets the association with Commercial's Billing Account. - string Claim { get; set; } - /// Gets collection Id. - string CollectionId { get; set; } - /// Gets or sets collection name. - string CollectionName { get; set; } - /// Indicating whether the collection is enabled or disabled. - bool? Enabled { get; set; } - /// Gets the number of offers associated with the collection. - long? NumberOfOffer { get; set; } - /// The collection data structure. - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionProperties Property { get; set; } - /// - /// Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, - /// explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request - /// - string[] SubscriptionsList { get; set; } - - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionProperties.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionProperties.PowerShell.cs deleted file mode 100644 index 930dc25448e3..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionProperties.PowerShell.cs +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 -{ - using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; - - /// The collection details - [System.ComponentModel.TypeConverter(typeof(CollectionPropertiesTypeConverter))] - public partial class CollectionProperties - { - - /// - /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the - /// object before it is returned. Implement this method in a partial class to enable this behavior - /// - /// The global::System.Collections.IDictionary content that should be used. - - partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); - - /// - /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object - /// before it is returned. Implement this method in a partial class to enable this behavior - /// - /// The global::System.Management.Automation.PSObject content that should be used. - - partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); - - /// - /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization - /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. - /// Implement this method in a partial class to enable this behavior. - /// - /// The global::System.Collections.IDictionary content that should be used. - /// Determines if the rest of the serialization should be processed, or if the method should return - /// instantly. - - partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); - - /// - /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization - /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. - /// Implement this method in a partial class to enable this behavior. - /// - /// The global::System.Management.Automation.PSObject content that should be used. - /// Determines if the rest of the serialization should be processed, or if the method should return - /// instantly. - - partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); - - /// - /// Deserializes a into a new instance of . - /// - /// The global::System.Collections.IDictionary content that should be used. - internal CollectionProperties(global::System.Collections.IDictionary content) - { - bool returnNow = false; - BeforeDeserializeDictionary(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("CollectionId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).CollectionId = (string) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).CollectionId, global::System.Convert.ToString); - } - if (content.Contains("CollectionName")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).CollectionName = (string) content.GetValueForProperty("CollectionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).CollectionName, global::System.Convert.ToString); - } - if (content.Contains("Claim")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).Claim = (string) content.GetValueForProperty("Claim",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).Claim, global::System.Convert.ToString); - } - if (content.Contains("AllSubscription")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).AllSubscription = (bool?) content.GetValueForProperty("AllSubscription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).AllSubscription, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); - } - if (content.Contains("SubscriptionsList")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).SubscriptionsList = (string[]) content.GetValueForProperty("SubscriptionsList",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).SubscriptionsList, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); - } - if (content.Contains("Enabled")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); - } - if (content.Contains("NumberOfOffer")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).NumberOfOffer = (long?) content.GetValueForProperty("NumberOfOffer",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).NumberOfOffer, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); - } - AfterDeserializeDictionary(content); - } - - /// - /// Deserializes a into a new instance of . - /// - /// The global::System.Management.Automation.PSObject content that should be used. - internal CollectionProperties(global::System.Management.Automation.PSObject content) - { - bool returnNow = false; - BeforeDeserializePSObject(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("CollectionId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).CollectionId = (string) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).CollectionId, global::System.Convert.ToString); - } - if (content.Contains("CollectionName")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).CollectionName = (string) content.GetValueForProperty("CollectionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).CollectionName, global::System.Convert.ToString); - } - if (content.Contains("Claim")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).Claim = (string) content.GetValueForProperty("Claim",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).Claim, global::System.Convert.ToString); - } - if (content.Contains("AllSubscription")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).AllSubscription = (bool?) content.GetValueForProperty("AllSubscription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).AllSubscription, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); - } - if (content.Contains("SubscriptionsList")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).SubscriptionsList = (string[]) content.GetValueForProperty("SubscriptionsList",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).SubscriptionsList, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); - } - if (content.Contains("Enabled")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); - } - if (content.Contains("NumberOfOffer")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).NumberOfOffer = (long?) content.GetValueForProperty("NumberOfOffer",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal)this).NumberOfOffer, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); - } - AfterDeserializePSObject(content); - } - - /// - /// Deserializes a into an instance of . - /// - /// The global::System.Collections.IDictionary content that should be used. - /// - /// an instance of . - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) - { - return new CollectionProperties(content); - } - - /// - /// Deserializes a into an instance of . - /// - /// The global::System.Management.Automation.PSObject content that should be used. - /// - /// an instance of . - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) - { - return new CollectionProperties(content); - } - - /// - /// Creates a new instance of , deserializing the content from a json string. - /// - /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); - - /// Serializes this instance to a json string. - - /// a containing this model serialized to JSON text. - public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); - } - /// The collection details - [System.ComponentModel.TypeConverter(typeof(CollectionPropertiesTypeConverter))] - public partial interface ICollectionProperties - - { - - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Offer.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Offer.PowerShell.cs deleted file mode 100644 index b0c587e629c0..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Offer.PowerShell.cs +++ /dev/null @@ -1,310 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 -{ - using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; - - /// The privateStore offer data structure. - [System.ComponentModel.TypeConverter(typeof(OfferTypeConverter))] - public partial class Offer - { - - /// - /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the - /// object before it is returned. Implement this method in a partial class to enable this behavior - /// - /// The global::System.Collections.IDictionary content that should be used. - - partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); - - /// - /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object - /// before it is returned. Implement this method in a partial class to enable this behavior - /// - /// The global::System.Management.Automation.PSObject content that should be used. - - partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); - - /// - /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization - /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. - /// Implement this method in a partial class to enable this behavior. - /// - /// The global::System.Collections.IDictionary content that should be used. - /// Determines if the rest of the serialization should be processed, or if the method should return - /// instantly. - - partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); - - /// - /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization - /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. - /// Implement this method in a partial class to enable this behavior. - /// - /// The global::System.Management.Automation.PSObject content that should be used. - /// Determines if the rest of the serialization should be processed, or if the method should return - /// instantly. - - partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); - - /// - /// Deserializes a into an instance of . - /// - /// The global::System.Collections.IDictionary content that should be used. - /// - /// an instance of . - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer DeserializeFromDictionary(global::System.Collections.IDictionary content) - { - return new Offer(content); - } - - /// - /// Deserializes a into an instance of . - /// - /// The global::System.Management.Automation.PSObject content that should be used. - /// - /// an instance of . - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer DeserializeFromPSObject(global::System.Management.Automation.PSObject content) - { - return new Offer(content); - } - - /// - /// Creates a new instance of , deserializing the content from a json string. - /// - /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); - - /// - /// Deserializes a into a new instance of . - /// - /// The global::System.Collections.IDictionary content that should be used. - internal Offer(global::System.Collections.IDictionary content) - { - bool returnNow = false; - BeforeDeserializeDictionary(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("Property")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("SystemDataCreatedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataCreatedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemDataCreatedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataLastModifiedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemData")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SystemDataTypeConverter.ConvertFrom); - } - if (content.Contains("Id")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id, global::System.Convert.ToString); - } - if (content.Contains("Name")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name, global::System.Convert.ToString); - } - if (content.Contains("Type")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type, global::System.Convert.ToString); - } - if (content.Contains("UniqueOfferId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).UniqueOfferId = (string) content.GetValueForProperty("UniqueOfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).UniqueOfferId, global::System.Convert.ToString); - } - if (content.Contains("DisplayName")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).DisplayName, global::System.Convert.ToString); - } - if (content.Contains("PublisherDisplayName")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).PublisherDisplayName = (string) content.GetValueForProperty("PublisherDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).PublisherDisplayName, global::System.Convert.ToString); - } - if (content.Contains("ETag")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).ETag, global::System.Convert.ToString); - } - if (content.Contains("PrivateStoreId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).PrivateStoreId = (string) content.GetValueForProperty("PrivateStoreId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).PrivateStoreId, global::System.Convert.ToString); - } - if (content.Contains("CreatedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).CreatedAt = (string) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).CreatedAt, global::System.Convert.ToString); - } - if (content.Contains("ModifiedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).ModifiedAt = (string) content.GetValueForProperty("ModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).ModifiedAt, global::System.Convert.ToString); - } - if (content.Contains("SpecificPlanIdsLimitation")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).SpecificPlanIdsLimitation = (string[]) content.GetValueForProperty("SpecificPlanIdsLimitation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).SpecificPlanIdsLimitation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); - } - if (content.Contains("UpdateSuppressedDueIdempotence")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).UpdateSuppressedDueIdempotence = (bool?) content.GetValueForProperty("UpdateSuppressedDueIdempotence",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).UpdateSuppressedDueIdempotence, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); - } - if (content.Contains("IconFileUri")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).IconFileUri = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris) content.GetValueForProperty("IconFileUri",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).IconFileUri, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferPropertiesIconFileUrisTypeConverter.ConvertFrom); - } - if (content.Contains("Plan")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).Plan = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan[]) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).Plan, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanTypeConverter.ConvertFrom)); - } - AfterDeserializeDictionary(content); - } - - /// - /// Deserializes a into a new instance of . - /// - /// The global::System.Management.Automation.PSObject content that should be used. - internal Offer(global::System.Management.Automation.PSObject content) - { - bool returnNow = false; - BeforeDeserializePSObject(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("Property")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("SystemDataCreatedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataCreatedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemDataCreatedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataLastModifiedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemData")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SystemDataTypeConverter.ConvertFrom); - } - if (content.Contains("Id")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id, global::System.Convert.ToString); - } - if (content.Contains("Name")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name, global::System.Convert.ToString); - } - if (content.Contains("Type")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type, global::System.Convert.ToString); - } - if (content.Contains("UniqueOfferId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).UniqueOfferId = (string) content.GetValueForProperty("UniqueOfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).UniqueOfferId, global::System.Convert.ToString); - } - if (content.Contains("DisplayName")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).DisplayName, global::System.Convert.ToString); - } - if (content.Contains("PublisherDisplayName")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).PublisherDisplayName = (string) content.GetValueForProperty("PublisherDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).PublisherDisplayName, global::System.Convert.ToString); - } - if (content.Contains("ETag")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).ETag, global::System.Convert.ToString); - } - if (content.Contains("PrivateStoreId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).PrivateStoreId = (string) content.GetValueForProperty("PrivateStoreId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).PrivateStoreId, global::System.Convert.ToString); - } - if (content.Contains("CreatedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).CreatedAt = (string) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).CreatedAt, global::System.Convert.ToString); - } - if (content.Contains("ModifiedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).ModifiedAt = (string) content.GetValueForProperty("ModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).ModifiedAt, global::System.Convert.ToString); - } - if (content.Contains("SpecificPlanIdsLimitation")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).SpecificPlanIdsLimitation = (string[]) content.GetValueForProperty("SpecificPlanIdsLimitation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).SpecificPlanIdsLimitation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); - } - if (content.Contains("UpdateSuppressedDueIdempotence")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).UpdateSuppressedDueIdempotence = (bool?) content.GetValueForProperty("UpdateSuppressedDueIdempotence",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).UpdateSuppressedDueIdempotence, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); - } - if (content.Contains("IconFileUri")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).IconFileUri = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris) content.GetValueForProperty("IconFileUri",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).IconFileUri, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferPropertiesIconFileUrisTypeConverter.ConvertFrom); - } - if (content.Contains("Plan")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).Plan = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan[]) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal)this).Plan, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanTypeConverter.ConvertFrom)); - } - AfterDeserializePSObject(content); - } - - /// Serializes this instance to a json string. - - /// a containing this model serialized to JSON text. - public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); - } - /// The privateStore offer data structure. - [System.ComponentModel.TypeConverter(typeof(OfferTypeConverter))] - public partial interface IOffer - - { - - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStore.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStore.PowerShell.cs deleted file mode 100644 index 5b13a99c3d4b..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStore.PowerShell.cs +++ /dev/null @@ -1,310 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 -{ - using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; - - /// The PrivateStore data structure. - [System.ComponentModel.TypeConverter(typeof(PrivateStoreTypeConverter))] - public partial class PrivateStore - { - - /// - /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the - /// object before it is returned. Implement this method in a partial class to enable this behavior - /// - /// The global::System.Collections.IDictionary content that should be used. - - partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); - - /// - /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object - /// before it is returned. Implement this method in a partial class to enable this behavior - /// - /// The global::System.Management.Automation.PSObject content that should be used. - - partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); - - /// - /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization - /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. - /// Implement this method in a partial class to enable this behavior. - /// - /// The global::System.Collections.IDictionary content that should be used. - /// Determines if the rest of the serialization should be processed, or if the method should return - /// instantly. - - partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); - - /// - /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization - /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. - /// Implement this method in a partial class to enable this behavior. - /// - /// The global::System.Management.Automation.PSObject content that should be used. - /// Determines if the rest of the serialization should be processed, or if the method should return - /// instantly. - - partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); - - /// - /// Deserializes a into an instance of . - /// - /// The global::System.Collections.IDictionary content that should be used. - /// - /// an instance of . - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore DeserializeFromDictionary(global::System.Collections.IDictionary content) - { - return new PrivateStore(content); - } - - /// - /// Deserializes a into an instance of . - /// - /// The global::System.Management.Automation.PSObject content that should be used. - /// - /// an instance of . - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore DeserializeFromPSObject(global::System.Management.Automation.PSObject content) - { - return new PrivateStore(content); - } - - /// - /// Creates a new instance of , deserializing the content from a json string. - /// - /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); - - /// - /// Deserializes a into a new instance of . - /// - /// The global::System.Collections.IDictionary content that should be used. - internal PrivateStore(global::System.Collections.IDictionary content) - { - bool returnNow = false; - BeforeDeserializeDictionary(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("Property")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStorePropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("SystemDataCreatedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataCreatedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemDataCreatedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataLastModifiedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemData")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SystemDataTypeConverter.ConvertFrom); - } - if (content.Contains("Id")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id, global::System.Convert.ToString); - } - if (content.Contains("Name")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name, global::System.Convert.ToString); - } - if (content.Contains("Type")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type, global::System.Convert.ToString); - } - if (content.Contains("Availability")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).Availability = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability?) content.GetValueForProperty("Availability",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).Availability, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability.CreateFrom); - } - if (content.Contains("NotificationsSetting")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).NotificationsSetting = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsProperties) content.GetValueForProperty("NotificationsSetting",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).NotificationsSetting, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.NotificationsSettingsPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("PrivateStoreId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).PrivateStoreId = (string) content.GetValueForProperty("PrivateStoreId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).PrivateStoreId, global::System.Convert.ToString); - } - if (content.Contains("ETag")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).ETag, global::System.Convert.ToString); - } - if (content.Contains("PrivateStoreName")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).PrivateStoreName = (string) content.GetValueForProperty("PrivateStoreName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).PrivateStoreName, global::System.Convert.ToString); - } - if (content.Contains("TenantId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).TenantId = (string) content.GetValueForProperty("TenantId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).TenantId, global::System.Convert.ToString); - } - if (content.Contains("IsGov")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).IsGov = (bool?) content.GetValueForProperty("IsGov",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).IsGov, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); - } - if (content.Contains("CollectionId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).CollectionId = (string[]) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); - } - if (content.Contains("Branding")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).Branding = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding) content.GetValueForProperty("Branding",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).Branding, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStorePropertiesBrandingTypeConverter.ConvertFrom); - } - if (content.Contains("NotificationSettingRecipient")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).NotificationSettingRecipient = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[]) content.GetValueForProperty("NotificationSettingRecipient",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).NotificationSettingRecipient, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RecipientTypeConverter.ConvertFrom)); - } - if (content.Contains("NotificationSettingSendToAllMarketplaceAdmin")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).NotificationSettingSendToAllMarketplaceAdmin = (bool?) content.GetValueForProperty("NotificationSettingSendToAllMarketplaceAdmin",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).NotificationSettingSendToAllMarketplaceAdmin, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); - } - AfterDeserializeDictionary(content); - } - - /// - /// Deserializes a into a new instance of . - /// - /// The global::System.Management.Automation.PSObject content that should be used. - internal PrivateStore(global::System.Management.Automation.PSObject content) - { - bool returnNow = false; - BeforeDeserializePSObject(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("Property")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStorePropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("SystemDataCreatedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataCreatedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemDataCreatedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataLastModifiedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemData")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SystemDataTypeConverter.ConvertFrom); - } - if (content.Contains("Id")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id, global::System.Convert.ToString); - } - if (content.Contains("Name")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name, global::System.Convert.ToString); - } - if (content.Contains("Type")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type, global::System.Convert.ToString); - } - if (content.Contains("Availability")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).Availability = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability?) content.GetValueForProperty("Availability",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).Availability, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability.CreateFrom); - } - if (content.Contains("NotificationsSetting")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).NotificationsSetting = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsProperties) content.GetValueForProperty("NotificationsSetting",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).NotificationsSetting, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.NotificationsSettingsPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("PrivateStoreId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).PrivateStoreId = (string) content.GetValueForProperty("PrivateStoreId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).PrivateStoreId, global::System.Convert.ToString); - } - if (content.Contains("ETag")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).ETag, global::System.Convert.ToString); - } - if (content.Contains("PrivateStoreName")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).PrivateStoreName = (string) content.GetValueForProperty("PrivateStoreName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).PrivateStoreName, global::System.Convert.ToString); - } - if (content.Contains("TenantId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).TenantId = (string) content.GetValueForProperty("TenantId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).TenantId, global::System.Convert.ToString); - } - if (content.Contains("IsGov")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).IsGov = (bool?) content.GetValueForProperty("IsGov",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).IsGov, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); - } - if (content.Contains("CollectionId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).CollectionId = (string[]) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); - } - if (content.Contains("Branding")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).Branding = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding) content.GetValueForProperty("Branding",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).Branding, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStorePropertiesBrandingTypeConverter.ConvertFrom); - } - if (content.Contains("NotificationSettingRecipient")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).NotificationSettingRecipient = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[]) content.GetValueForProperty("NotificationSettingRecipient",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).NotificationSettingRecipient, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RecipientTypeConverter.ConvertFrom)); - } - if (content.Contains("NotificationSettingSendToAllMarketplaceAdmin")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).NotificationSettingSendToAllMarketplaceAdmin = (bool?) content.GetValueForProperty("NotificationSettingSendToAllMarketplaceAdmin",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal)this).NotificationSettingSendToAllMarketplaceAdmin, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); - } - AfterDeserializePSObject(content); - } - - /// Serializes this instance to a json string. - - /// a containing this model serialized to JSON text. - public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); - } - /// The PrivateStore data structure. - [System.ComponentModel.TypeConverter(typeof(PrivateStoreTypeConverter))] - public partial interface IPrivateStore - - { - - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreNotificationsState.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreNotificationsState.cs deleted file mode 100644 index 9246a24ba452..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreNotificationsState.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 -{ - using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; - - /// Get private store notifications state - public partial class PrivateStoreNotificationsState : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsState, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsStateInternal - { - - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetails[] _approvalRequest; - - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetails[] ApprovalRequest { get => this._approvalRequest; set => this._approvalRequest = value; } - - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotifications[] _newNotification; - - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotifications[] NewNotification { get => this._newNotification; set => this._newNotification = value; } - - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotifications[] _stopSellNotification; - - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotifications[] StopSellNotification { get => this._stopSellNotification; set => this._stopSellNotification = value; } - - /// Creates an new instance. - public PrivateStoreNotificationsState() - { - - } - } - /// Get private store notifications state - public partial interface IPrivateStoreNotificationsState : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable - { - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"", - SerializedName = @"approvalRequests", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetails) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetails[] ApprovalRequest { get; set; } - - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"", - SerializedName = @"newNotifications", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotifications) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotifications[] NewNotification { get; set; } - - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"", - SerializedName = @"stopSellNotifications", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotifications) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotifications[] StopSellNotification { get; set; } - - } - /// Get private store notifications state - internal partial interface IPrivateStoreNotificationsStateInternal - - { - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetails[] ApprovalRequest { get; set; } - - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotifications[] NewNotification { get; set; } - - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotifications[] StopSellNotification { get; set; } - - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansPayload.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansPayload.cs deleted file mode 100644 index 2ba56c96bad3..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansPayload.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 -{ - using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; - - /// Query approved plans payload - public partial class QueryApprovedPlansPayload : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayload, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayloadInternal - { - - /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlans Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayloadInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryApprovedPlans()); set { {_property = value;} } } - - /// Offer id - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string OfferId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansInternal)Property).OfferId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansInternal)Property).OfferId = value ?? null; } - - /// Offer plan ids - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string[] PlanId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansInternal)Property).PlanId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansInternal)Property).PlanId = value ?? null /* arrayOf */; } - - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlans _property; - - /// Query approved plans details - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlans Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryApprovedPlans()); set => this._property = value; } - - /// Creates an new instance. - public QueryApprovedPlansPayload() - { - - } - } - /// Query approved plans payload - public partial interface IQueryApprovedPlansPayload : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable - { - /// Offer id - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"Offer id", - SerializedName = @"offerId", - PossibleTypes = new [] { typeof(string) })] - string OfferId { get; set; } - /// Offer plan ids - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"Offer plan ids", - SerializedName = @"planIds", - PossibleTypes = new [] { typeof(string) })] - string[] PlanId { get; set; } - - } - /// Query approved plans payload - internal partial interface IQueryApprovedPlansPayloadInternal - - { - /// Offer id - string OfferId { get; set; } - /// Offer plan ids - string[] PlanId { get; set; } - /// Query approved plans details - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlans Property { get; set; } - - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalResource.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalResource.PowerShell.cs deleted file mode 100644 index 8dec989e5b4c..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalResource.PowerShell.cs +++ /dev/null @@ -1,272 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 -{ - using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; - - /// Request approval resource. - [System.ComponentModel.TypeConverter(typeof(RequestApprovalResourceTypeConverter))] - public partial class RequestApprovalResource - { - - /// - /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the - /// object before it is returned. Implement this method in a partial class to enable this behavior - /// - /// The global::System.Collections.IDictionary content that should be used. - - partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); - - /// - /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object - /// before it is returned. Implement this method in a partial class to enable this behavior - /// - /// The global::System.Management.Automation.PSObject content that should be used. - - partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); - - /// - /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization - /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. - /// Implement this method in a partial class to enable this behavior. - /// - /// The global::System.Collections.IDictionary content that should be used. - /// Determines if the rest of the serialization should be processed, or if the method should return - /// instantly. - - partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); - - /// - /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization - /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. - /// Implement this method in a partial class to enable this behavior. - /// - /// The global::System.Management.Automation.PSObject content that should be used. - /// Determines if the rest of the serialization should be processed, or if the method should return - /// instantly. - - partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); - - /// - /// Deserializes a into an instance of . - /// - /// The global::System.Collections.IDictionary content that should be used. - /// - /// an instance of . - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource DeserializeFromDictionary(global::System.Collections.IDictionary content) - { - return new RequestApprovalResource(content); - } - - /// - /// Deserializes a into an instance of . - /// - /// The global::System.Management.Automation.PSObject content that should be used. - /// - /// an instance of . - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) - { - return new RequestApprovalResource(content); - } - - /// - /// Creates a new instance of , deserializing the content from a json string. - /// - /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); - - /// - /// Deserializes a into a new instance of . - /// - /// The global::System.Collections.IDictionary content that should be used. - internal RequestApprovalResource(global::System.Collections.IDictionary content) - { - bool returnNow = false; - BeforeDeserializeDictionary(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("Property")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("SystemDataCreatedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataCreatedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemDataCreatedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataLastModifiedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemData")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SystemDataTypeConverter.ConvertFrom); - } - if (content.Contains("Id")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id, global::System.Convert.ToString); - } - if (content.Contains("Name")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name, global::System.Convert.ToString); - } - if (content.Contains("Type")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type, global::System.Convert.ToString); - } - if (content.Contains("OfferId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).OfferId, global::System.Convert.ToString); - } - if (content.Contains("OfferDisplayName")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).OfferDisplayName = (string) content.GetValueForProperty("OfferDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).OfferDisplayName, global::System.Convert.ToString); - } - if (content.Contains("PublisherId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).PublisherId, global::System.Convert.ToString); - } - if (content.Contains("PlansDetail")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).PlansDetail = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails[]) content.GetValueForProperty("PlansDetail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).PlansDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanDetailsTypeConverter.ConvertFrom)); - } - if (content.Contains("IsClosed")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).IsClosed = (bool?) content.GetValueForProperty("IsClosed",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).IsClosed, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); - } - if (content.Contains("MessageCode")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); - } - AfterDeserializeDictionary(content); - } - - /// - /// Deserializes a into a new instance of . - /// - /// The global::System.Management.Automation.PSObject content that should be used. - internal RequestApprovalResource(global::System.Management.Automation.PSObject content) - { - bool returnNow = false; - BeforeDeserializePSObject(content, ref returnNow); - if (returnNow) - { - return; - } - // actually deserialize - if (content.Contains("Property")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalPropertiesTypeConverter.ConvertFrom); - } - if (content.Contains("SystemDataCreatedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataCreatedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemDataCreatedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedBy")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); - } - if (content.Contains("SystemDataLastModifiedByType")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); - } - if (content.Contains("SystemDataLastModifiedAt")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); - } - if (content.Contains("SystemData")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SystemDataTypeConverter.ConvertFrom); - } - if (content.Contains("Id")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id, global::System.Convert.ToString); - } - if (content.Contains("Name")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name, global::System.Convert.ToString); - } - if (content.Contains("Type")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type, global::System.Convert.ToString); - } - if (content.Contains("OfferId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).OfferId, global::System.Convert.ToString); - } - if (content.Contains("OfferDisplayName")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).OfferDisplayName = (string) content.GetValueForProperty("OfferDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).OfferDisplayName, global::System.Convert.ToString); - } - if (content.Contains("PublisherId")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).PublisherId, global::System.Convert.ToString); - } - if (content.Contains("PlansDetail")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).PlansDetail = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails[]) content.GetValueForProperty("PlansDetail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).PlansDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanDetailsTypeConverter.ConvertFrom)); - } - if (content.Contains("IsClosed")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).IsClosed = (bool?) content.GetValueForProperty("IsClosed",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).IsClosed, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); - } - if (content.Contains("MessageCode")) - { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); - } - AfterDeserializePSObject(content); - } - - /// Serializes this instance to a json string. - - /// a containing this model serialized to JSON text. - public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); - } - /// Request approval resource. - [System.ComponentModel.TypeConverter(typeof(RequestApprovalResourceTypeConverter))] - public partial interface IRequestApprovalResource - - { - - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BillingAccountsResponse.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BillingAccountsResponse.PowerShell.cs similarity index 71% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BillingAccountsResponse.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/BillingAccountsResponse.PowerShell.cs index 3904133f5560..98fa951998e3 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BillingAccountsResponse.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BillingAccountsResponse.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class BillingAccountsResponse /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class BillingAccountsResponse /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,7 +55,15 @@ public partial class BillingAccountsResponse partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -68,13 +78,13 @@ internal BillingAccountsResponse(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("BillingAccount")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBillingAccountsResponseInternal)this).BillingAccount = (string[]) content.GetValueForProperty("BillingAccount",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBillingAccountsResponseInternal)this).BillingAccount, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponseInternal)this).BillingAccount = (System.Collections.Generic.List) content.GetValueForProperty("BillingAccount",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponseInternal)this).BillingAccount, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -89,35 +99,33 @@ internal BillingAccountsResponse(global::System.Management.Automation.PSObject c // actually deserialize if (content.Contains("BillingAccount")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBillingAccountsResponseInternal)this).BillingAccount = (string[]) content.GetValueForProperty("BillingAccount",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBillingAccountsResponseInternal)this).BillingAccount, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponseInternal)this).BillingAccount = (System.Collections.Generic.List) content.GetValueForProperty("BillingAccount",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponseInternal)this).BillingAccount, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBillingAccountsResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new BillingAccountsResponse(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBillingAccountsResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new BillingAccountsResponse(content); } @@ -126,13 +134,25 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBillingAccountsResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Billing accounts response object [System.ComponentModel.TypeConverter(typeof(BillingAccountsResponseTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BillingAccountsResponse.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BillingAccountsResponse.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BillingAccountsResponse.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/BillingAccountsResponse.TypeConverter.cs index 9703f84dd778..d13f3b426764 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BillingAccountsResponse.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BillingAccountsResponse.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class BillingAccountsResponseTypeConverter : global::System.Manag { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBillingAccountsResponse ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBillingAccountsResponse).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BillingAccountsResponse.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BillingAccountsResponse.cs similarity index 70% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BillingAccountsResponse.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/BillingAccountsResponse.cs index 80bb17db72fd..ae65e22c3ec6 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BillingAccountsResponse.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BillingAccountsResponse.cs @@ -3,22 +3,22 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Billing accounts response object public partial class BillingAccountsResponse : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBillingAccountsResponse, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBillingAccountsResponseInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponseInternal { /// Backing field for property. - private string[] _billingAccount; + private System.Collections.Generic.List _billingAccount; /// Billing accounts list [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public string[] BillingAccount { get => this._billingAccount; set => this._billingAccount = value; } + public System.Collections.Generic.List BillingAccount { get => this._billingAccount; set => this._billingAccount = value; } /// Creates an new instance. public BillingAccountsResponse() @@ -34,10 +34,13 @@ public partial interface IBillingAccountsResponse : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Billing accounts list", SerializedName = @"billingAccounts", PossibleTypes = new [] { typeof(string) })] - string[] BillingAccount { get; set; } + System.Collections.Generic.List BillingAccount { get; set; } } /// Billing accounts response object @@ -45,7 +48,7 @@ internal partial interface IBillingAccountsResponseInternal { /// Billing accounts list - string[] BillingAccount { get; set; } + System.Collections.Generic.List BillingAccount { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BillingAccountsResponse.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BillingAccountsResponse.json.cs similarity index 86% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BillingAccountsResponse.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/BillingAccountsResponse.json.cs index cc7279b024f7..49eeaddbcf61 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BillingAccountsResponse.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BillingAccountsResponse.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class BillingAccountsResponse partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class BillingAccountsResponse /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class BillingAccountsResponse /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -63,18 +65,18 @@ internal BillingAccountsResponse(Microsoft.Azure.PowerShell.Cmdlets.Marketplace. { return; } - {_billingAccount = If( json?.PropertyT("billingAccounts"), out var __jsonBillingAccounts) ? If( __jsonBillingAccounts as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : BillingAccount;} + {_billingAccount = If( json?.PropertyT("billingAccounts"), out var __jsonBillingAccounts) ? If( __jsonBillingAccounts as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _billingAccount;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBillingAccountsResponse. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBillingAccountsResponse. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBillingAccountsResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new BillingAccountsResponse(json) : null; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsDetails.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsDetails.PowerShell.cs similarity index 69% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsDetails.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsDetails.PowerShell.cs index 04b24b82baec..c476f3dc927b 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsDetails.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsDetails.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class BulkCollectionsDetails /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class BulkCollectionsDetails /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,7 +55,15 @@ public partial class BulkCollectionsDetails partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -68,17 +78,17 @@ internal BulkCollectionsDetails(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("CollectionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetailsInternal)this).CollectionId = (string[]) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetailsInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetailsInternal)this).CollectionId = (System.Collections.Generic.List) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetailsInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("Action")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetailsInternal)this).Action = (string) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetailsInternal)this).Action, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetailsInternal)this).Action = (string) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetailsInternal)this).Action, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -93,37 +103,37 @@ internal BulkCollectionsDetails(global::System.Management.Automation.PSObject co // actually deserialize if (content.Contains("CollectionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetailsInternal)this).CollectionId = (string[]) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetailsInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetailsInternal)this).CollectionId = (System.Collections.Generic.List) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetailsInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("Action")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetailsInternal)this).Action = (string) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetailsInternal)this).Action, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetailsInternal)this).Action = (string) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetailsInternal)this).Action, global::System.Convert.ToString); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new BulkCollectionsDetails(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new BulkCollectionsDetails(content); } @@ -132,13 +142,25 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Bulk collection details [System.ComponentModel.TypeConverter(typeof(BulkCollectionsDetailsTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsDetails.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsDetails.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsDetails.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsDetails.TypeConverter.cs index 47cbd39cdac1..e73370a619a5 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsDetails.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsDetails.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class BulkCollectionsDetailsTypeConverter : global::System.Manage { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetails ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetails ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetails).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetails).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsDetails.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsDetails.cs similarity index 78% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsDetails.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsDetails.cs index 8e8063876d08..c3b358dfc964 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsDetails.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsDetails.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Bulk collection details public partial class BulkCollectionsDetails : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetails, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetailsInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetails, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetailsInternal { /// Backing field for property. @@ -21,11 +21,11 @@ public partial class BulkCollectionsDetails : public string Action { get => this._action; set => this._action = value; } /// Backing field for property. - private string[] _collectionId; + private System.Collections.Generic.List _collectionId; /// collection ids list that the action is performed on [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public string[] CollectionId { get => this._collectionId; set => this._collectionId = value; } + public System.Collections.Generic.List CollectionId { get => this._collectionId; set => this._collectionId = value; } /// Creates an new instance. public BulkCollectionsDetails() @@ -41,6 +41,9 @@ public partial interface IBulkCollectionsDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Action to perform (For example: EnableCollections, DisableCollections)", SerializedName = @"action", PossibleTypes = new [] { typeof(string) })] @@ -49,10 +52,13 @@ public partial interface IBulkCollectionsDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"collection ids list that the action is performed on", SerializedName = @"collectionIds", PossibleTypes = new [] { typeof(string) })] - string[] CollectionId { get; set; } + System.Collections.Generic.List CollectionId { get; set; } } /// Bulk collection details @@ -62,7 +68,7 @@ internal partial interface IBulkCollectionsDetailsInternal /// Action to perform (For example: EnableCollections, DisableCollections) string Action { get; set; } /// collection ids list that the action is performed on - string[] CollectionId { get; set; } + System.Collections.Generic.List CollectionId { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsDetails.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsDetails.json.cs similarity index 86% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsDetails.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsDetails.json.cs index a3f115f39d9c..a78a50eae3a0 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsDetails.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsDetails.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class BulkCollectionsDetails partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class BulkCollectionsDetails /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class BulkCollectionsDetails /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -63,19 +65,19 @@ internal BulkCollectionsDetails(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.R { return; } - {_collectionId = If( json?.PropertyT("collectionIds"), out var __jsonCollectionIds) ? If( __jsonCollectionIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : CollectionId;} - {_action = If( json?.PropertyT("action"), out var __jsonAction) ? (string)__jsonAction : (string)Action;} + {_collectionId = If( json?.PropertyT("collectionIds"), out var __jsonCollectionIds) ? If( __jsonCollectionIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _collectionId;} + {_action = If( json?.PropertyT("action"), out var __jsonAction) ? (string)__jsonAction : (string)_action;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetails. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetails. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetails. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetails. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new BulkCollectionsDetails(json) : null; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsPayload.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsPayload.PowerShell.cs similarity index 65% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsPayload.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsPayload.PowerShell.cs index 38bacdc1e09c..c3e5d698f143 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsPayload.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsPayload.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class BulkCollectionsPayload /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class BulkCollectionsPayload /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,7 +55,15 @@ public partial class BulkCollectionsPayload partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -68,21 +78,21 @@ internal BulkCollectionsPayload(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayloadInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayloadInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.BulkCollectionsDetailsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayloadInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayloadInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.BulkCollectionsDetailsTypeConverter.ConvertFrom); } if (content.Contains("CollectionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayloadInternal)this).CollectionId = (string[]) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayloadInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayloadInternal)this).CollectionId = (System.Collections.Generic.List) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayloadInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("Action")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayloadInternal)this).Action = (string) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayloadInternal)this).Action, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayloadInternal)this).Action = (string) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayloadInternal)this).Action, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -97,41 +107,41 @@ internal BulkCollectionsPayload(global::System.Management.Automation.PSObject co // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayloadInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayloadInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.BulkCollectionsDetailsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayloadInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayloadInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.BulkCollectionsDetailsTypeConverter.ConvertFrom); } if (content.Contains("CollectionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayloadInternal)this).CollectionId = (string[]) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayloadInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayloadInternal)this).CollectionId = (System.Collections.Generic.List) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayloadInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("Action")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayloadInternal)this).Action = (string) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayloadInternal)this).Action, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayloadInternal)this).Action = (string) content.GetValueForProperty("Action",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayloadInternal)this).Action, global::System.Convert.ToString); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new BulkCollectionsPayload(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new BulkCollectionsPayload(content); } @@ -140,13 +150,25 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Bulk collections action properties [System.ComponentModel.TypeConverter(typeof(BulkCollectionsPayloadTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsPayload.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsPayload.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsPayload.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsPayload.TypeConverter.cs index 5fec1884c8f0..9e1fa37835bb 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsPayload.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsPayload.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class BulkCollectionsPayloadTypeConverter : global::System.Manage { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsPayload.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsPayload.cs similarity index 63% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsPayload.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsPayload.cs index ea31e5878043..ac82945bc803 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsPayload.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsPayload.cs @@ -3,33 +3,33 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Bulk collections action properties public partial class BulkCollectionsPayload : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayloadInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayloadInternal { /// Action to perform (For example: EnableCollections, DisableCollections) [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string Action { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetailsInternal)Property).Action; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetailsInternal)Property).Action = value ?? null; } + public string Action { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetailsInternal)Property).Action; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetailsInternal)Property).Action = value ?? null; } /// collection ids list that the action is performed on [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string[] CollectionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetailsInternal)Property).CollectionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetailsInternal)Property).CollectionId = value ?? null /* arrayOf */; } + public System.Collections.Generic.List CollectionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetailsInternal)Property).CollectionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetailsInternal)Property).CollectionId = value ?? null /* arrayOf */; } /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetails Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayloadInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.BulkCollectionsDetails()); set { {_property = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetails Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayloadInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.BulkCollectionsDetails()); set { {_property = value;} } } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetails _property; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetails _property; /// bulk collections properties details [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetails Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.BulkCollectionsDetails()); set => this._property = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetails Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.BulkCollectionsDetails()); set => this._property = value; } /// Creates an new instance. public BulkCollectionsPayload() @@ -45,6 +45,9 @@ public partial interface IBulkCollectionsPayload : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Action to perform (For example: EnableCollections, DisableCollections)", SerializedName = @"action", PossibleTypes = new [] { typeof(string) })] @@ -53,10 +56,13 @@ public partial interface IBulkCollectionsPayload : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"collection ids list that the action is performed on", SerializedName = @"collectionIds", PossibleTypes = new [] { typeof(string) })] - string[] CollectionId { get; set; } + System.Collections.Generic.List CollectionId { get; set; } } /// Bulk collections action properties @@ -66,9 +72,9 @@ internal partial interface IBulkCollectionsPayloadInternal /// Action to perform (For example: EnableCollections, DisableCollections) string Action { get; set; } /// collection ids list that the action is performed on - string[] CollectionId { get; set; } + System.Collections.Generic.List CollectionId { get; set; } /// bulk collections properties details - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsDetails Property { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsDetails Property { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsPayload.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsPayload.json.cs similarity index 88% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsPayload.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsPayload.json.cs index 373d1c56bb2a..79916289314d 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsPayload.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsPayload.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class BulkCollectionsPayload partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class BulkCollectionsPayload /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class BulkCollectionsPayload /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -63,18 +65,18 @@ internal BulkCollectionsPayload(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.R { return; } - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.BulkCollectionsDetails.FromJson(__jsonProperties) : Property;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.BulkCollectionsDetails.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new BulkCollectionsPayload(json) : null; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsResponse.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsResponse.PowerShell.cs similarity index 64% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsResponse.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsResponse.PowerShell.cs index cc212cafeb9a..4f5b903f6294 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsResponse.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsResponse.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -34,7 +34,8 @@ public partial class BulkCollectionsResponse /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -46,7 +47,8 @@ public partial class BulkCollectionsResponse /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -56,7 +58,15 @@ public partial class BulkCollectionsResponse partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -71,17 +81,17 @@ internal BulkCollectionsResponse(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Succeeded")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponseInternal)this).Succeeded = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[]) content.GetValueForProperty("Succeeded",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponseInternal)this).Succeeded, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponseInternal)this).Succeeded = (System.Collections.Generic.List) content.GetValueForProperty("Succeeded",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponseInternal)this).Succeeded, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsDetailsTypeConverter.ConvertFrom)); } if (content.Contains("Failed")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponseInternal)this).Failed = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[]) content.GetValueForProperty("Failed",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponseInternal)this).Failed, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponseInternal)this).Failed = (System.Collections.Generic.List) content.GetValueForProperty("Failed",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponseInternal)this).Failed, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsDetailsTypeConverter.ConvertFrom)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -96,39 +106,37 @@ internal BulkCollectionsResponse(global::System.Management.Automation.PSObject c // actually deserialize if (content.Contains("Succeeded")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponseInternal)this).Succeeded = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[]) content.GetValueForProperty("Succeeded",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponseInternal)this).Succeeded, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponseInternal)this).Succeeded = (System.Collections.Generic.List) content.GetValueForProperty("Succeeded",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponseInternal)this).Succeeded, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsDetailsTypeConverter.ConvertFrom)); } if (content.Contains("Failed")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponseInternal)this).Failed = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[]) content.GetValueForProperty("Failed",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponseInternal)this).Failed, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponseInternal)this).Failed = (System.Collections.Generic.List) content.GetValueForProperty("Failed",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponseInternal)this).Failed, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsDetailsTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new BulkCollectionsResponse(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new BulkCollectionsResponse(content); } @@ -137,13 +145,25 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The bulk collections response. The response contains two lists that indicate for each collection whether the operation /// succeeded or failed diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsResponse.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsResponse.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsResponse.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsResponse.TypeConverter.cs index 91147dc79d92..c4cc7676194e 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsResponse.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsResponse.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class BulkCollectionsResponseTypeConverter : global::System.Manag { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponse ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponse).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsResponse.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsResponse.cs similarity index 60% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsResponse.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsResponse.cs index c53927bc605e..758c7f90e000 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsResponse.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsResponse.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -12,23 +12,23 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 /// succeeded or failed /// public partial class BulkCollectionsResponse : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponse, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponseInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponseInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[] _failed; + private System.Collections.Generic.List _failed; /// Failed collections [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[] Failed { get => this._failed; set => this._failed = value; } + public System.Collections.Generic.List Failed { get => this._failed; set => this._failed = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[] _succeeded; + private System.Collections.Generic.List _succeeded; /// Succeeded collections [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[] Succeeded { get => this._succeeded; set => this._succeeded = value; } + public System.Collections.Generic.List Succeeded { get => this._succeeded; set => this._succeeded = value; } /// Creates an new instance. public BulkCollectionsResponse() @@ -45,18 +45,24 @@ public partial interface IBulkCollectionsResponse : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Failed collections", SerializedName = @"failed", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[] Failed { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetails) })] + System.Collections.Generic.List Failed { get; set; } /// Succeeded collections [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Succeeded collections", SerializedName = @"succeeded", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[] Succeeded { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetails) })] + System.Collections.Generic.List Succeeded { get; set; } } /// The bulk collections response. The response contains two lists that indicate for each collection whether the operation @@ -65,9 +71,9 @@ internal partial interface IBulkCollectionsResponseInternal { /// Failed collections - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[] Failed { get; set; } + System.Collections.Generic.List Failed { get; set; } /// Succeeded collections - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[] Succeeded { get; set; } + System.Collections.Generic.List Succeeded { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsResponse.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsResponse.json.cs similarity index 82% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsResponse.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsResponse.json.cs index f59e07bb2a1e..19146b8a440c 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/BulkCollectionsResponse.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/BulkCollectionsResponse.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -23,7 +23,7 @@ public partial class BulkCollectionsResponse partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -33,7 +33,8 @@ public partial class BulkCollectionsResponse /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -45,7 +46,8 @@ public partial class BulkCollectionsResponse /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -66,19 +68,19 @@ internal BulkCollectionsResponse(Microsoft.Azure.PowerShell.Cmdlets.Marketplace. { return; } - {_succeeded = If( json?.PropertyT("succeeded"), out var __jsonSucceeded) ? If( __jsonSucceeded as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsDetails.FromJson(__u) )) ))() : null : Succeeded;} - {_failed = If( json?.PropertyT("failed"), out var __jsonFailed) ? If( __jsonFailed as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsDetails.FromJson(__p) )) ))() : null : Failed;} + {_succeeded = If( json?.PropertyT("succeeded"), out var __jsonSucceeded) ? If( __jsonSucceeded as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsDetails.FromJson(__u) )) ))() : null : _succeeded;} + {_failed = If( json?.PropertyT("failed"), out var __jsonFailed) ? If( __jsonFailed as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsDetails.FromJson(__p) )) ))() : null : _failed;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponse. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponse. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new BulkCollectionsResponse(json) : null; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Collection.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Collection.PowerShell.cs new file mode 100644 index 000000000000..af2d2f51cfef --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Collection.PowerShell.cs @@ -0,0 +1,324 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// The Collection data structure. + [System.ComponentModel.TypeConverter(typeof(CollectionTypeConverter))] + public partial class Collection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Collection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("CollectionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).CollectionId = (string) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).CollectionId, global::System.Convert.ToString); + } + if (content.Contains("CollectionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).CollectionName = (string) content.GetValueForProperty("CollectionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).CollectionName, global::System.Convert.ToString); + } + if (content.Contains("Claim")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).Claim = (string) content.GetValueForProperty("Claim",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).Claim, global::System.Convert.ToString); + } + if (content.Contains("AllSubscription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).AllSubscription = (bool?) content.GetValueForProperty("AllSubscription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).AllSubscription, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ApproveAllItem")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).ApproveAllItem = (bool?) content.GetValueForProperty("ApproveAllItem",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).ApproveAllItem, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ApproveAllItemsModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).ApproveAllItemsModifiedAt = (global::System.DateTime?) content.GetValueForProperty("ApproveAllItemsModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).ApproveAllItemsModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SubscriptionsList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).SubscriptionsList = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionsList",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).SubscriptionsList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("NumberOfOffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).NumberOfOffer = (long?) content.GetValueForProperty("NumberOfOffer",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).NumberOfOffer, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("AppliedRule")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).AppliedRule = (System.Collections.Generic.List) content.GetValueForProperty("AppliedRule",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).AppliedRule, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RuleTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Collection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("CollectionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).CollectionId = (string) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).CollectionId, global::System.Convert.ToString); + } + if (content.Contains("CollectionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).CollectionName = (string) content.GetValueForProperty("CollectionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).CollectionName, global::System.Convert.ToString); + } + if (content.Contains("Claim")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).Claim = (string) content.GetValueForProperty("Claim",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).Claim, global::System.Convert.ToString); + } + if (content.Contains("AllSubscription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).AllSubscription = (bool?) content.GetValueForProperty("AllSubscription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).AllSubscription, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ApproveAllItem")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).ApproveAllItem = (bool?) content.GetValueForProperty("ApproveAllItem",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).ApproveAllItem, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ApproveAllItemsModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).ApproveAllItemsModifiedAt = (global::System.DateTime?) content.GetValueForProperty("ApproveAllItemsModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).ApproveAllItemsModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SubscriptionsList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).SubscriptionsList = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionsList",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).SubscriptionsList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("NumberOfOffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).NumberOfOffer = (long?) content.GetValueForProperty("NumberOfOffer",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).NumberOfOffer, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("AppliedRule")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).AppliedRule = (System.Collections.Generic.List) content.GetValueForProperty("AppliedRule",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal)this).AppliedRule, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RuleTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Collection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Collection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The Collection data structure. + [System.ComponentModel.TypeConverter(typeof(CollectionTypeConverter))] + public partial interface ICollection + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Collection.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Collection.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Collection.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/Collection.TypeConverter.cs index 088986926d97..5617955a7393 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Collection.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Collection.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,19 @@ public partial class CollectionTypeConverter : global::System.Management.Automat { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +74,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +99,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Collection.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Collection.cs new file mode 100644 index 000000000000..dacab916cca6 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Collection.cs @@ -0,0 +1,320 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// The Collection data structure. + public partial class Collection : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Resource(); + + /// Indicating whether all subscriptions are selected (=true) or not (=false). + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public bool? AllSubscription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).AllSubscription; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).AllSubscription = value ?? default(bool); } + + /// Gets list of collection rules + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public System.Collections.Generic.List AppliedRule { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).AppliedRule; } + + /// + /// Indicating whether all items are approved for this collection (=true) or not (=false). + /// + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public bool? ApproveAllItem { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).ApproveAllItem; } + + /// Gets the modified date of all items approved. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public global::System.DateTime? ApproveAllItemsModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).ApproveAllItemsModifiedAt; } + + /// Gets or sets the association with Commercial's Billing Account. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public string Claim { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).Claim; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).Claim = value ?? null; } + + /// Gets collection Id. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public string CollectionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).CollectionId; } + + /// Gets or sets collection name. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public string CollectionName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).CollectionName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).CollectionName = value ?? null; } + + /// Indicating whether the collection is enabled or disabled. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public bool? Enabled { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).Enabled; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).Enabled = value ?? default(bool); } + + /// The resource ID. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Id; } + + /// Internal Acessors for AppliedRule + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal.AppliedRule { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).AppliedRule; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).AppliedRule = value; } + + /// Internal Acessors for ApproveAllItem + bool? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal.ApproveAllItem { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).ApproveAllItem; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).ApproveAllItem = value; } + + /// Internal Acessors for ApproveAllItemsModifiedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal.ApproveAllItemsModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).ApproveAllItemsModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).ApproveAllItemsModifiedAt = value; } + + /// Internal Acessors for CollectionId + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal.CollectionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).CollectionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).CollectionId = value; } + + /// Internal Acessors for NumberOfOffer + long? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal.NumberOfOffer { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).NumberOfOffer; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).NumberOfOffer = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionProperties Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionProperties()); set { {_property = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemData = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Type = value; } + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Name; } + + /// Gets the number of offers associated with the collection. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public long? NumberOfOffer { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).NumberOfOffer; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionProperties _property; + + /// The collection data structure. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionProperties()); set => this._property = value; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } + + /// + /// Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, + /// explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request + /// + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public System.Collections.Generic.List SubscriptionsList { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).SubscriptionsList; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)Property).SubscriptionsList = value ?? null /* arrayOf */; } + + /// Metadata pertaining to creation and last modification of the resource + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemData; } + + /// The timestamp of resource creation (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + + /// The identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedBy = value ?? null; } + + /// The type of identity that created the resource + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedByType = value ?? null; } + + /// The timestamp of resource last modification (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + + /// The identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedBy = value ?? null; } + + /// The type of identity that last modified the resource + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedByType = value ?? null; } + + /// The type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public Collection() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// The Collection data structure. + public partial interface ICollection : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResource + { + /// Indicating whether all subscriptions are selected (=true) or not (=false). + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Indicating whether all subscriptions are selected (=true) or not (=false).", + SerializedName = @"allSubscriptions", + PossibleTypes = new [] { typeof(bool) })] + bool? AllSubscription { get; set; } + /// Gets list of collection rules + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets list of collection rules", + SerializedName = @"appliedRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRule) })] + System.Collections.Generic.List AppliedRule { get; } + /// + /// Indicating whether all items are approved for this collection (=true) or not (=false). + /// + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Indicating whether all items are approved for this collection (=true) or not (=false).", + SerializedName = @"approveAllItems", + PossibleTypes = new [] { typeof(bool) })] + bool? ApproveAllItem { get; } + /// Gets the modified date of all items approved. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets the modified date of all items approved.", + SerializedName = @"approveAllItemsModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ApproveAllItemsModifiedAt { get; } + /// Gets or sets the association with Commercial's Billing Account. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets the association with Commercial's Billing Account.", + SerializedName = @"claim", + PossibleTypes = new [] { typeof(string) })] + string Claim { get; set; } + /// Gets collection Id. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets collection Id.", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + string CollectionId { get; } + /// Gets or sets collection name. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets collection name.", + SerializedName = @"collectionName", + PossibleTypes = new [] { typeof(string) })] + string CollectionName { get; set; } + /// Indicating whether the collection is enabled or disabled. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Indicating whether the collection is enabled or disabled.", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(bool) })] + bool? Enabled { get; set; } + /// Gets the number of offers associated with the collection. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets the number of offers associated with the collection.", + SerializedName = @"numberOfOffers", + PossibleTypes = new [] { typeof(long) })] + long? NumberOfOffer { get; } + /// + /// Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, + /// explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request + /// + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request", + SerializedName = @"subscriptionsList", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List SubscriptionsList { get; set; } + + } + /// The Collection data structure. + internal partial interface ICollectionInternal : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal + { + /// Indicating whether all subscriptions are selected (=true) or not (=false). + bool? AllSubscription { get; set; } + /// Gets list of collection rules + System.Collections.Generic.List AppliedRule { get; set; } + /// + /// Indicating whether all items are approved for this collection (=true) or not (=false). + /// + bool? ApproveAllItem { get; set; } + /// Gets the modified date of all items approved. + global::System.DateTime? ApproveAllItemsModifiedAt { get; set; } + /// Gets or sets the association with Commercial's Billing Account. + string Claim { get; set; } + /// Gets collection Id. + string CollectionId { get; set; } + /// Gets or sets collection name. + string CollectionName { get; set; } + /// Indicating whether the collection is enabled or disabled. + bool? Enabled { get; set; } + /// Gets the number of offers associated with the collection. + long? NumberOfOffer { get; set; } + /// The collection data structure. + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionProperties Property { get; set; } + /// + /// Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, + /// explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request + /// + System.Collections.Generic.List SubscriptionsList { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Collection.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Collection.json.cs similarity index 88% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Collection.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/Collection.json.cs index db68c169eb34..e044ea48f958 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Collection.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Collection.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class Collection partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class Collection /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class Collection /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -63,19 +65,19 @@ internal Collection(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json. { return; } - __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Resource(json); - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionProperties.FromJson(__jsonProperties) : Property;} + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionProperties.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new Collection(json) : null; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsPayload.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsPayload.PowerShell.cs new file mode 100644 index 000000000000..14a5aab57ab5 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsPayload.PowerShell.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// Suggested subscription list + [System.ComponentModel.TypeConverter(typeof(CollectionOffersByAllContextsPayloadTypeConverter))] + public partial class CollectionOffersByAllContextsPayload + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CollectionOffersByAllContextsPayload(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayloadInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayloadInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByAllContextsPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayloadInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayloadInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CollectionOffersByAllContextsPayload(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayloadInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayloadInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByAllContextsPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayloadInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayloadInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayload DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CollectionOffersByAllContextsPayload(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayload DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CollectionOffersByAllContextsPayload(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayload FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Suggested subscription list + [System.ComponentModel.TypeConverter(typeof(CollectionOffersByAllContextsPayloadTypeConverter))] + public partial interface ICollectionOffersByAllContextsPayload + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsPayload.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsPayload.TypeConverter.cs new file mode 100644 index 000000000000..2165259bf08b --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsPayload.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CollectionOffersByAllContextsPayloadTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayload ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayload).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CollectionOffersByAllContextsPayload.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CollectionOffersByAllContextsPayload.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CollectionOffersByAllContextsPayload.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsPayload.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsPayload.cs new file mode 100644 index 000000000000..78df546487f5 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsPayload.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Suggested subscription list + public partial class CollectionOffersByAllContextsPayload : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayload, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayloadInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsProperties Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayloadInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByAllContextsProperties()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsProperties _property; + + /// Subscriptions ids list + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByAllContextsProperties()); set => this._property = value; } + + /// Subscription ids list + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public System.Collections.Generic.List SubscriptionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPropertiesInternal)Property).SubscriptionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPropertiesInternal)Property).SubscriptionId = value ?? null /* arrayOf */; } + + /// Creates an new instance. + public CollectionOffersByAllContextsPayload() + { + + } + } + /// Suggested subscription list + public partial interface ICollectionOffersByAllContextsPayload : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + /// Subscription ids list + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Subscription ids list", + SerializedName = @"subscriptionIds", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List SubscriptionId { get; set; } + + } + /// Suggested subscription list + internal partial interface ICollectionOffersByAllContextsPayloadInternal + + { + /// Subscriptions ids list + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsProperties Property { get; set; } + /// Subscription ids list + System.Collections.Generic.List SubscriptionId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsPayload.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsPayload.json.cs new file mode 100644 index 000000000000..221fd8b32bf6 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsPayload.json.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Suggested subscription list + public partial class CollectionOffersByAllContextsPayload + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal CollectionOffersByAllContextsPayload(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByAllContextsProperties.FromJson(__jsonProperties) : _property;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayload. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayload FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new CollectionOffersByAllContextsPayload(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsProperties.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsProperties.PowerShell.cs new file mode 100644 index 000000000000..60dcc105f1f7 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsProperties.PowerShell.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// Suggested subscription list + [System.ComponentModel.TypeConverter(typeof(CollectionOffersByAllContextsPropertiesTypeConverter))] + public partial class CollectionOffersByAllContextsProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CollectionOffersByAllContextsProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPropertiesInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPropertiesInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CollectionOffersByAllContextsProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPropertiesInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPropertiesInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CollectionOffersByAllContextsProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CollectionOffersByAllContextsProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Suggested subscription list + [System.ComponentModel.TypeConverter(typeof(CollectionOffersByAllContextsPropertiesTypeConverter))] + public partial interface ICollectionOffersByAllContextsProperties + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsProperties.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsProperties.TypeConverter.cs new file mode 100644 index 000000000000..9ad913fe923d --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsProperties.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CollectionOffersByAllContextsPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CollectionOffersByAllContextsProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CollectionOffersByAllContextsProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CollectionOffersByAllContextsProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsProperties.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsProperties.cs new file mode 100644 index 000000000000..87f1ba448c20 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsProperties.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Suggested subscription list + public partial class CollectionOffersByAllContextsProperties : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsProperties, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPropertiesInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _subscriptionId; + + /// Subscription ids list + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Creates an new instance. + public CollectionOffersByAllContextsProperties() + { + + } + } + /// Suggested subscription list + public partial interface ICollectionOffersByAllContextsProperties : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + /// Subscription ids list + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Subscription ids list", + SerializedName = @"subscriptionIds", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List SubscriptionId { get; set; } + + } + /// Suggested subscription list + internal partial interface ICollectionOffersByAllContextsPropertiesInternal + + { + /// Subscription ids list + System.Collections.Generic.List SubscriptionId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsProperties.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsProperties.json.cs new file mode 100644 index 000000000000..1928e69acb70 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByAllContextsProperties.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Suggested subscription list + public partial class CollectionOffersByAllContextsProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal CollectionOffersByAllContextsProperties(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_subscriptionId = If( json?.PropertyT("subscriptionIds"), out var __jsonSubscriptionIds) ? If( __jsonSubscriptionIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _subscriptionId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new CollectionOffersByAllContextsProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._subscriptionId) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __x in this._subscriptionId ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("subscriptionIds",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContext.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContext.PowerShell.cs new file mode 100644 index 000000000000..24f5e2d6730d --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContext.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// List of offers and plans that restricted to the context + [System.ComponentModel.TypeConverter(typeof(CollectionOffersByContextTypeConverter))] + public partial class CollectionOffersByContext + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CollectionOffersByContext(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Offer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextInternal)this).Offer = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffers) content.GetValueForProperty("Offer",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextInternal)this).Offer, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByContextOffersTypeConverter.ConvertFrom); + } + if (content.Contains("Context")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextInternal)this).Context = (string) content.GetValueForProperty("Context",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextInternal)this).Context, global::System.Convert.ToString); + } + if (content.Contains("OfferValue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextInternal)this).OfferValue = (System.Collections.Generic.List) content.GetValueForProperty("OfferValue",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextInternal)this).OfferValue, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferPropertiesTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CollectionOffersByContext(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Offer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextInternal)this).Offer = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffers) content.GetValueForProperty("Offer",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextInternal)this).Offer, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByContextOffersTypeConverter.ConvertFrom); + } + if (content.Contains("Context")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextInternal)this).Context = (string) content.GetValueForProperty("Context",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextInternal)this).Context, global::System.Convert.ToString); + } + if (content.Contains("OfferValue")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextInternal)this).OfferValue = (System.Collections.Generic.List) content.GetValueForProperty("OfferValue",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextInternal)this).OfferValue, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferPropertiesTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContext DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CollectionOffersByContext(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContext DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CollectionOffersByContext(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContext FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// List of offers and plans that restricted to the context + [System.ComponentModel.TypeConverter(typeof(CollectionOffersByContextTypeConverter))] + public partial interface ICollectionOffersByContext + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContext.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContext.TypeConverter.cs new file mode 100644 index 000000000000..67228c4eba19 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContext.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CollectionOffersByContextTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContext ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContext).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CollectionOffersByContext.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CollectionOffersByContext.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CollectionOffersByContext.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContext.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContext.cs new file mode 100644 index 000000000000..e820df3134dc --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContext.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// List of offers and plans that restricted to the context + public partial class CollectionOffersByContext : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContext, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextInternal + { + + /// Backing field for property. + private string _context; + + /// Offer's context, e.g. subscription ID, tenant ID. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string Context { get => this._context; } + + /// Internal Acessors for Context + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextInternal.Context { get => this._context; set { {_context = value;} } } + + /// Internal Acessors for Offer + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffers Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextInternal.Offer { get => (this._offer = this._offer ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByContextOffers()); set { {_offer = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffers _offer; + + /// List of offers + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffers Offer { get => (this._offer = this._offer ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByContextOffers()); set => this._offer = value; } + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public System.Collections.Generic.List OfferValue { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffersInternal)Offer).Value; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffersInternal)Offer).Value = value ?? null /* arrayOf */; } + + /// Creates an new instance. + public CollectionOffersByContext() + { + + } + } + /// List of offers and plans that restricted to the context + public partial interface ICollectionOffersByContext : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + /// Offer's context, e.g. subscription ID, tenant ID. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Offer's context, e.g. subscription ID, tenant ID.", + SerializedName = @"context", + PossibleTypes = new [] { typeof(string) })] + string Context { get; } + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties) })] + System.Collections.Generic.List OfferValue { get; set; } + + } + /// List of offers and plans that restricted to the context + internal partial interface ICollectionOffersByContextInternal + + { + /// Offer's context, e.g. subscription ID, tenant ID. + string Context { get; set; } + /// List of offers + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffers Offer { get; set; } + + System.Collections.Generic.List OfferValue { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContext.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContext.json.cs new file mode 100644 index 000000000000..c6b433f17b0a --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContext.json.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// List of offers and plans that restricted to the context + public partial class CollectionOffersByContext + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal CollectionOffersByContext(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_offer = If( json?.PropertyT("offers"), out var __jsonOffers) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByContextOffers.FromJson(__jsonOffers) : _offer;} + {_context = If( json?.PropertyT("context"), out var __jsonContext) ? (string)__jsonContext : (string)_context;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContext. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContext. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContext FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new CollectionOffersByContext(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._offer ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) this._offer.ToJson(null,serializationMode) : null, "offers" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._context)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._context.ToString()) : null, "context" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextList.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextList.PowerShell.cs new file mode 100644 index 000000000000..30f78c0eff96 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextList.PowerShell.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// List of objects which describes offers per context. An empty GUID is a public context. + /// + [System.ComponentModel.TypeConverter(typeof(CollectionOffersByContextListTypeConverter))] + public partial class CollectionOffersByContextList + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CollectionOffersByContextList(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByContextTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextListInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CollectionOffersByContextList(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByContextTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextListInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextList DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CollectionOffersByContextList(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CollectionOffersByContextList(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// List of objects which describes offers per context. An empty GUID is a public context. + [System.ComponentModel.TypeConverter(typeof(CollectionOffersByContextListTypeConverter))] + public partial interface ICollectionOffersByContextList + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextList.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextList.TypeConverter.cs new file mode 100644 index 000000000000..fea6963be1df --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextList.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CollectionOffersByContextListTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextList ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextList).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CollectionOffersByContextList.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CollectionOffersByContextList.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CollectionOffersByContextList.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextList.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextList.cs new file mode 100644 index 000000000000..2eb6d86a15c4 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextList.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// + /// List of objects which describes offers per context. An empty GUID is a public context. + /// + public partial class CollectionOffersByContextList : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextList, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextListInternal + { + + /// Internal Acessors for Value + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextListInternal.Value { get => this._value; set { {_value = value;} } } + + /// Backing field for property. + private string _nextLink; + + /// URL to get the next set of offer list per context results if there are any. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; } + + /// Creates an new instance. + public CollectionOffersByContextList() + { + + } + } + /// List of objects which describes offers per context. An empty GUID is a public context. + public partial interface ICollectionOffersByContextList : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + /// URL to get the next set of offer list per context results if there are any. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"URL to get the next set of offer list per context results if there are any.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContext) })] + System.Collections.Generic.List Value { get; } + + } + /// List of objects which describes offers per context. An empty GUID is a public context. + internal partial interface ICollectionOffersByContextListInternal + + { + /// URL to get the next set of offer list per context results if there are any. + string NextLink { get; set; } + + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextList.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextList.json.cs new file mode 100644 index 000000000000..29db76e6eb5c --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextList.json.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// + /// List of objects which describes offers per context. An empty GUID is a public context. + /// + public partial class CollectionOffersByContextList + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal CollectionOffersByContextList(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContext) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByContext.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextList. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextList. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextList FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new CollectionOffersByContextList(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextOffers.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextOffers.PowerShell.cs new file mode 100644 index 000000000000..5e22473a3723 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextOffers.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// List of offers + [System.ComponentModel.TypeConverter(typeof(CollectionOffersByContextOffersTypeConverter))] + public partial class CollectionOffersByContextOffers + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CollectionOffersByContextOffers(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffersInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffersInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferPropertiesTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CollectionOffersByContextOffers(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffersInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffersInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferPropertiesTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffers DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CollectionOffersByContextOffers(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffers DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CollectionOffersByContextOffers(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffers FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// List of offers + [System.ComponentModel.TypeConverter(typeof(CollectionOffersByContextOffersTypeConverter))] + public partial interface ICollectionOffersByContextOffers + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextOffers.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextOffers.TypeConverter.cs new file mode 100644 index 000000000000..1d270d02179c --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextOffers.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CollectionOffersByContextOffersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffers ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffers).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CollectionOffersByContextOffers.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CollectionOffersByContextOffers.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CollectionOffersByContextOffers.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextOffers.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextOffers.cs new file mode 100644 index 000000000000..f04e49a14d2a --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextOffers.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// List of offers + public partial class CollectionOffersByContextOffers : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffers, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffersInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _value; + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public CollectionOffersByContextOffers() + { + + } + } + /// List of offers + public partial interface ICollectionOffersByContextOffers : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties) })] + System.Collections.Generic.List Value { get; set; } + + } + /// List of offers + internal partial interface ICollectionOffersByContextOffersInternal + + { + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextOffers.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextOffers.json.cs new file mode 100644 index 000000000000..8714e421bff2 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionOffersByContextOffers.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// List of offers + public partial class CollectionOffersByContextOffers + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal CollectionOffersByContextOffers(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferProperties.FromJson(__u) )) ))() : null : _value;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffers. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffers. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextOffers FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new CollectionOffersByContextOffers(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionProperties.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionProperties.PowerShell.cs new file mode 100644 index 000000000000..206b2bb84045 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionProperties.PowerShell.cs @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// The collection details + [System.ComponentModel.TypeConverter(typeof(CollectionPropertiesTypeConverter))] + public partial class CollectionProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal CollectionProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CollectionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).CollectionId = (string) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).CollectionId, global::System.Convert.ToString); + } + if (content.Contains("CollectionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).CollectionName = (string) content.GetValueForProperty("CollectionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).CollectionName, global::System.Convert.ToString); + } + if (content.Contains("Claim")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).Claim = (string) content.GetValueForProperty("Claim",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).Claim, global::System.Convert.ToString); + } + if (content.Contains("AllSubscription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).AllSubscription = (bool?) content.GetValueForProperty("AllSubscription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).AllSubscription, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ApproveAllItem")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).ApproveAllItem = (bool?) content.GetValueForProperty("ApproveAllItem",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).ApproveAllItem, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ApproveAllItemsModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).ApproveAllItemsModifiedAt = (global::System.DateTime?) content.GetValueForProperty("ApproveAllItemsModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).ApproveAllItemsModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SubscriptionsList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).SubscriptionsList = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionsList",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).SubscriptionsList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("NumberOfOffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).NumberOfOffer = (long?) content.GetValueForProperty("NumberOfOffer",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).NumberOfOffer, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("AppliedRule")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).AppliedRule = (System.Collections.Generic.List) content.GetValueForProperty("AppliedRule",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).AppliedRule, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RuleTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CollectionProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CollectionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).CollectionId = (string) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).CollectionId, global::System.Convert.ToString); + } + if (content.Contains("CollectionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).CollectionName = (string) content.GetValueForProperty("CollectionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).CollectionName, global::System.Convert.ToString); + } + if (content.Contains("Claim")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).Claim = (string) content.GetValueForProperty("Claim",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).Claim, global::System.Convert.ToString); + } + if (content.Contains("AllSubscription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).AllSubscription = (bool?) content.GetValueForProperty("AllSubscription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).AllSubscription, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ApproveAllItem")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).ApproveAllItem = (bool?) content.GetValueForProperty("ApproveAllItem",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).ApproveAllItem, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ApproveAllItemsModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).ApproveAllItemsModifiedAt = (global::System.DateTime?) content.GetValueForProperty("ApproveAllItemsModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).ApproveAllItemsModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SubscriptionsList")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).SubscriptionsList = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionsList",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).SubscriptionsList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("Enabled")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).Enabled = (bool?) content.GetValueForProperty("Enabled",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).Enabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("NumberOfOffer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).NumberOfOffer = (long?) content.GetValueForProperty("NumberOfOffer",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).NumberOfOffer, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("AppliedRule")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).AppliedRule = (System.Collections.Generic.List) content.GetValueForProperty("AppliedRule",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal)this).AppliedRule, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RuleTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CollectionProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CollectionProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The collection details + [System.ComponentModel.TypeConverter(typeof(CollectionPropertiesTypeConverter))] + public partial interface ICollectionProperties + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionProperties.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionProperties.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionProperties.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionProperties.TypeConverter.cs index 1df33ab77e3c..f23b9c1b1894 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionProperties.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionProperties.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class CollectionPropertiesTypeConverter : global::System.Manageme { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionProperties.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionProperties.cs similarity index 58% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionProperties.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionProperties.cs index 7a8bc5a0a120..fcddba596ce9 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionProperties.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionProperties.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// The collection details public partial class CollectionProperties : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionProperties, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionProperties, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal { /// Backing field for property. @@ -20,6 +20,29 @@ public partial class CollectionProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] public bool? AllSubscription { get => this._allSubscription; set => this._allSubscription = value; } + /// Backing field for property. + private System.Collections.Generic.List _appliedRule; + + /// Gets list of collection rules + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List AppliedRule { get => this._appliedRule; } + + /// Backing field for property. + private bool? _approveAllItem; + + /// + /// Indicating whether all items are approved for this collection (=true) or not (=false). + /// + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public bool? ApproveAllItem { get => this._approveAllItem; } + + /// Backing field for property. + private global::System.DateTime? _approveAllItemsModifiedAt; + + /// Gets the modified date of all items approved. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public global::System.DateTime? ApproveAllItemsModifiedAt { get => this._approveAllItemsModifiedAt; } + /// Backing field for property. private string _claim; @@ -48,11 +71,20 @@ public partial class CollectionProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] public bool? Enabled { get => this._enabled; set => this._enabled = value; } + /// Internal Acessors for AppliedRule + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal.AppliedRule { get => this._appliedRule; set { {_appliedRule = value;} } } + + /// Internal Acessors for ApproveAllItem + bool? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal.ApproveAllItem { get => this._approveAllItem; set { {_approveAllItem = value;} } } + + /// Internal Acessors for ApproveAllItemsModifiedAt + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal.ApproveAllItemsModifiedAt { get => this._approveAllItemsModifiedAt; set { {_approveAllItemsModifiedAt = value;} } } + /// Internal Acessors for CollectionId - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal.CollectionId { get => this._collectionId; set { {_collectionId = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal.CollectionId { get => this._collectionId; set { {_collectionId = value;} } } /// Internal Acessors for NumberOfOffer - long? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionPropertiesInternal.NumberOfOffer { get => this._numberOfOffer; set { {_numberOfOffer = value;} } } + long? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionPropertiesInternal.NumberOfOffer { get => this._numberOfOffer; set { {_numberOfOffer = value;} } } /// Backing field for property. private long? _numberOfOffer; @@ -62,14 +94,14 @@ public partial class CollectionProperties : public long? NumberOfOffer { get => this._numberOfOffer; } /// Backing field for property. - private string[] _subscriptionsList; + private System.Collections.Generic.List _subscriptionsList; /// /// Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, /// explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request /// [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public string[] SubscriptionsList { get => this._subscriptionsList; set => this._subscriptionsList = value; } + public System.Collections.Generic.List SubscriptionsList { get => this._subscriptionsList; set => this._subscriptionsList = value; } /// Creates an new instance. public CollectionProperties() @@ -85,14 +117,55 @@ public partial interface ICollectionProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Indicating whether all subscriptions are selected (=true) or not (=false).", SerializedName = @"allSubscriptions", PossibleTypes = new [] { typeof(bool) })] bool? AllSubscription { get; set; } + /// Gets list of collection rules + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets list of collection rules", + SerializedName = @"appliedRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRule) })] + System.Collections.Generic.List AppliedRule { get; } + /// + /// Indicating whether all items are approved for this collection (=true) or not (=false). + /// + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Indicating whether all items are approved for this collection (=true) or not (=false).", + SerializedName = @"approveAllItems", + PossibleTypes = new [] { typeof(bool) })] + bool? ApproveAllItem { get; } + /// Gets the modified date of all items approved. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Gets the modified date of all items approved.", + SerializedName = @"approveAllItemsModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? ApproveAllItemsModifiedAt { get; } /// Gets or sets the association with Commercial's Billing Account. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the association with Commercial's Billing Account.", SerializedName = @"claim", PossibleTypes = new [] { typeof(string) })] @@ -101,6 +174,9 @@ public partial interface ICollectionProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets collection Id.", SerializedName = @"collectionId", PossibleTypes = new [] { typeof(string) })] @@ -109,6 +185,9 @@ public partial interface ICollectionProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets collection name.", SerializedName = @"collectionName", PossibleTypes = new [] { typeof(string) })] @@ -117,6 +196,9 @@ public partial interface ICollectionProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Indicating whether the collection is enabled or disabled.", SerializedName = @"enabled", PossibleTypes = new [] { typeof(bool) })] @@ -125,6 +207,9 @@ public partial interface ICollectionProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets the number of offers associated with the collection.", SerializedName = @"numberOfOffers", PossibleTypes = new [] { typeof(long) })] @@ -136,10 +221,13 @@ public partial interface ICollectionProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request", SerializedName = @"subscriptionsList", PossibleTypes = new [] { typeof(string) })] - string[] SubscriptionsList { get; set; } + System.Collections.Generic.List SubscriptionsList { get; set; } } /// The collection details @@ -148,6 +236,14 @@ internal partial interface ICollectionPropertiesInternal { /// Indicating whether all subscriptions are selected (=true) or not (=false). bool? AllSubscription { get; set; } + /// Gets list of collection rules + System.Collections.Generic.List AppliedRule { get; set; } + /// + /// Indicating whether all items are approved for this collection (=true) or not (=false). + /// + bool? ApproveAllItem { get; set; } + /// Gets the modified date of all items approved. + global::System.DateTime? ApproveAllItemsModifiedAt { get; set; } /// Gets or sets the association with Commercial's Billing Account. string Claim { get; set; } /// Gets collection Id. @@ -162,7 +258,7 @@ internal partial interface ICollectionPropertiesInternal /// Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, /// explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request /// - string[] SubscriptionsList { get; set; } + System.Collections.Generic.List SubscriptionsList { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionProperties.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionProperties.json.cs similarity index 68% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionProperties.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionProperties.json.cs index c644b6146a9d..1cee1f3d3ad3 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionProperties.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionProperties.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class CollectionProperties partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class CollectionProperties /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class CollectionProperties /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -63,24 +65,27 @@ internal CollectionProperties(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Run { return; } - {_collectionId = If( json?.PropertyT("collectionId"), out var __jsonCollectionId) ? (string)__jsonCollectionId : (string)CollectionId;} - {_collectionName = If( json?.PropertyT("collectionName"), out var __jsonCollectionName) ? (string)__jsonCollectionName : (string)CollectionName;} - {_claim = If( json?.PropertyT("claim"), out var __jsonClaim) ? (string)__jsonClaim : (string)Claim;} - {_allSubscription = If( json?.PropertyT("allSubscriptions"), out var __jsonAllSubscriptions) ? (bool?)__jsonAllSubscriptions : AllSubscription;} - {_subscriptionsList = If( json?.PropertyT("subscriptionsList"), out var __jsonSubscriptionsList) ? If( __jsonSubscriptionsList as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : SubscriptionsList;} - {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : Enabled;} - {_numberOfOffer = If( json?.PropertyT("numberOfOffers"), out var __jsonNumberOfOffers) ? (long?)__jsonNumberOfOffers : NumberOfOffer;} + {_collectionId = If( json?.PropertyT("collectionId"), out var __jsonCollectionId) ? (string)__jsonCollectionId : (string)_collectionId;} + {_collectionName = If( json?.PropertyT("collectionName"), out var __jsonCollectionName) ? (string)__jsonCollectionName : (string)_collectionName;} + {_claim = If( json?.PropertyT("claim"), out var __jsonClaim) ? (string)__jsonClaim : (string)_claim;} + {_allSubscription = If( json?.PropertyT("allSubscriptions"), out var __jsonAllSubscriptions) ? (bool?)__jsonAllSubscriptions : _allSubscription;} + {_approveAllItem = If( json?.PropertyT("approveAllItems"), out var __jsonApproveAllItems) ? (bool?)__jsonApproveAllItems : _approveAllItem;} + {_approveAllItemsModifiedAt = If( json?.PropertyT("approveAllItemsModifiedAt"), out var __jsonApproveAllItemsModifiedAt) ? global::System.DateTime.TryParse((string)__jsonApproveAllItemsModifiedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonApproveAllItemsModifiedAtValue) ? __jsonApproveAllItemsModifiedAtValue : _approveAllItemsModifiedAt : _approveAllItemsModifiedAt;} + {_subscriptionsList = If( json?.PropertyT("subscriptionsList"), out var __jsonSubscriptionsList) ? If( __jsonSubscriptionsList as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _subscriptionsList;} + {_enabled = If( json?.PropertyT("enabled"), out var __jsonEnabled) ? (bool?)__jsonEnabled : _enabled;} + {_numberOfOffer = If( json?.PropertyT("numberOfOffers"), out var __jsonNumberOfOffers) ? (long?)__jsonNumberOfOffers : _numberOfOffer;} + {_appliedRule = If( json?.PropertyT("appliedRules"), out var __jsonAppliedRules) ? If( __jsonAppliedRules as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRule) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Rule.FromJson(__p) )) ))() : null : _appliedRule;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new CollectionProperties(json) : null; } @@ -104,13 +109,21 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._collectionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._collectionId.ToString()) : null, "collectionId" ,container.Add ); } AddIf( null != (((object)this._collectionName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._collectionName.ToString()) : null, "collectionName" ,container.Add ); AddIf( null != (((object)this._claim)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._claim.ToString()) : null, "claim" ,container.Add ); AddIf( null != this._allSubscription ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonBoolean((bool)this._allSubscription) : null, "allSubscriptions" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._approveAllItem ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonBoolean((bool)this._approveAllItem) : null, "approveAllItems" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._approveAllItemsModifiedAt ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._approveAllItemsModifiedAt?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "approveAllItemsModifiedAt" ,container.Add ); + } if (null != this._subscriptionsList) { var __w = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); @@ -121,10 +134,22 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs container.Add("subscriptionsList",__w); } AddIf( null != this._enabled ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonBoolean((bool)this._enabled) : null, "enabled" ,container.Add ); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != this._numberOfOffer ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNumber((long)this._numberOfOffer) : null, "numberOfOffers" ,container.Add ); } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._appliedRule) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __s in this._appliedRule ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("appliedRules",__r); + } + } AfterToJson(ref container); return container; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsDetails.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsDetails.PowerShell.cs similarity index 70% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsDetails.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsDetails.PowerShell.cs index ea2e26038028..6e0fb3ef9361 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsDetails.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsDetails.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class CollectionsDetails /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class CollectionsDetails /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,7 +55,15 @@ public partial class CollectionsDetails partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -68,17 +78,17 @@ internal CollectionsDetails(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("CollectionName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetailsInternal)this).CollectionName = (string) content.GetValueForProperty("CollectionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetailsInternal)this).CollectionName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetailsInternal)this).CollectionName = (string) content.GetValueForProperty("CollectionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetailsInternal)this).CollectionName, global::System.Convert.ToString); } if (content.Contains("CollectionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetailsInternal)this).CollectionId = (string) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetailsInternal)this).CollectionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetailsInternal)this).CollectionId = (string) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetailsInternal)this).CollectionId, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -93,37 +103,37 @@ internal CollectionsDetails(global::System.Management.Automation.PSObject conten // actually deserialize if (content.Contains("CollectionName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetailsInternal)this).CollectionName = (string) content.GetValueForProperty("CollectionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetailsInternal)this).CollectionName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetailsInternal)this).CollectionName = (string) content.GetValueForProperty("CollectionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetailsInternal)this).CollectionName, global::System.Convert.ToString); } if (content.Contains("CollectionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetailsInternal)this).CollectionId = (string) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetailsInternal)this).CollectionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetailsInternal)this).CollectionId = (string) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetailsInternal)this).CollectionId, global::System.Convert.ToString); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new CollectionsDetails(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new CollectionsDetails(content); } @@ -132,13 +142,25 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Collection name and id. [System.ComponentModel.TypeConverter(typeof(CollectionsDetailsTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsDetails.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsDetails.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsDetails.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsDetails.TypeConverter.cs index 30152964259d..5b6c3d69407b 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsDetails.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsDetails.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class CollectionsDetailsTypeConverter : global::System.Management { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetails ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetails).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsDetails.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsDetails.cs similarity index 87% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsDetails.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsDetails.cs index b7d1ac80dc72..311143289b44 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsDetails.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsDetails.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Collection name and id. public partial class CollectionsDetails : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetailsInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetails, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetailsInternal { /// Backing field for property. @@ -41,6 +41,9 @@ public partial interface ICollectionsDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Collection id.", SerializedName = @"collectionId", PossibleTypes = new [] { typeof(string) })] @@ -49,6 +52,9 @@ public partial interface ICollectionsDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Collection name.", SerializedName = @"collectionName", PossibleTypes = new [] { typeof(string) })] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsDetails.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsDetails.json.cs similarity index 89% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsDetails.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsDetails.json.cs index b9afb11333c4..0263f7e1a6d7 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsDetails.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsDetails.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class CollectionsDetails partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class CollectionsDetails /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class CollectionsDetails /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -63,19 +65,19 @@ internal CollectionsDetails(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runti { return; } - {_collectionName = If( json?.PropertyT("collectionName"), out var __jsonCollectionName) ? (string)__jsonCollectionName : (string)CollectionName;} - {_collectionId = If( json?.PropertyT("collectionId"), out var __jsonCollectionId) ? (string)__jsonCollectionId : (string)CollectionId;} + {_collectionName = If( json?.PropertyT("collectionName"), out var __jsonCollectionName) ? (string)__jsonCollectionName : (string)_collectionName;} + {_collectionId = If( json?.PropertyT("collectionId"), out var __jsonCollectionId) ? (string)__jsonCollectionId : (string)_collectionId;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetails. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetails. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new CollectionsDetails(json) : null; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsList.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsList.PowerShell.cs similarity index 67% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsList.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsList.PowerShell.cs index be98d27757d6..c5e281b1ed67 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsList.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsList.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -30,7 +30,8 @@ public partial class CollectionsList /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -42,7 +43,8 @@ public partial class CollectionsList /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -52,7 +54,15 @@ public partial class CollectionsList partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -67,17 +77,17 @@ internal CollectionsList(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsListInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsListInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsListInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsListInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -92,37 +102,37 @@ internal CollectionsList(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsListInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsListInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsListInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsListInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsList DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsList DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new CollectionsList(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new CollectionsList(content); } @@ -131,13 +141,25 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } [System.ComponentModel.TypeConverter(typeof(CollectionsListTypeConverter))] public partial interface ICollectionsList diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsList.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsList.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsList.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsList.TypeConverter.cs index 3cffeb92c36a..1a35576d9855 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsList.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsList.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class CollectionsListTypeConverter : global::System.Management.Au { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsList ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsList ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsList).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsList).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsList.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsList.cs similarity index 70% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsList.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsList.cs index ebbaad7ef431..f498bbd1d2aa 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsList.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsList.cs @@ -3,13 +3,13 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; public partial class CollectionsList : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsList, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsListInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsList, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsListInternal { /// Backing field for property. @@ -20,10 +20,10 @@ public partial class CollectionsList : public string NextLink { get => this._nextLink; set => this._nextLink = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection[] _value; + private System.Collections.Generic.List _value; [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection[] Value { get => this._value; set => this._value = value; } + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } /// Creates an new instance. public CollectionsList() @@ -38,6 +38,9 @@ public partial interface ICollectionsList : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"URL to get the next set of offer list results if there are any.", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -46,10 +49,13 @@ public partial interface ICollectionsList : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection[] Value { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection) })] + System.Collections.Generic.List Value { get; set; } } internal partial interface ICollectionsListInternal @@ -58,7 +64,7 @@ internal partial interface ICollectionsListInternal /// URL to get the next set of offer list results if there are any. string NextLink { get; set; } - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsList.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsList.json.cs similarity index 85% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsList.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsList.json.cs index 563f1b280ac6..1059edbd8dff 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsList.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsList.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -19,7 +19,7 @@ public partial class CollectionsList partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -29,7 +29,8 @@ public partial class CollectionsList /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -41,7 +42,8 @@ public partial class CollectionsList /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -62,19 +64,19 @@ internal CollectionsList(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime. { return; } - {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Collection.FromJson(__u) )) ))() : null : Value;} - {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Collection.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsList. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsList. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsList. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsList. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsList FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsList FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new CollectionsList(json) : null; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsSubscriptionsMappingDetails.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsSubscriptionsMappingDetails.PowerShell.cs similarity index 67% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsSubscriptionsMappingDetails.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsSubscriptionsMappingDetails.PowerShell.cs index 115198b2020b..be6b9b3c1825 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsSubscriptionsMappingDetails.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsSubscriptionsMappingDetails.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class CollectionsSubscriptionsMappingDetails /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class CollectionsSubscriptionsMappingDetails /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,7 +55,15 @@ public partial class CollectionsSubscriptionsMappingDetails partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -68,17 +78,17 @@ internal CollectionsSubscriptionsMappingDetails(global::System.Collections.IDict // actually deserialize if (content.Contains("CollectionName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetailsInternal)this).CollectionName = (string) content.GetValueForProperty("CollectionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetailsInternal)this).CollectionName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetailsInternal)this).CollectionName = (string) content.GetValueForProperty("CollectionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetailsInternal)this).CollectionName, global::System.Convert.ToString); } if (content.Contains("Subscription")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetailsInternal)this).Subscription = (string[]) content.GetValueForProperty("Subscription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetailsInternal)this).Subscription, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetailsInternal)this).Subscription = (System.Collections.Generic.List) content.GetValueForProperty("Subscription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetailsInternal)this).Subscription, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -93,39 +103,39 @@ internal CollectionsSubscriptionsMappingDetails(global::System.Management.Automa // actually deserialize if (content.Contains("CollectionName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetailsInternal)this).CollectionName = (string) content.GetValueForProperty("CollectionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetailsInternal)this).CollectionName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetailsInternal)this).CollectionName = (string) content.GetValueForProperty("CollectionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetailsInternal)this).CollectionName, global::System.Convert.ToString); } if (content.Contains("Subscription")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetailsInternal)this).Subscription = (string[]) content.GetValueForProperty("Subscription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetailsInternal)this).Subscription, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetailsInternal)this).Subscription = (System.Collections.Generic.List) content.GetValueForProperty("Subscription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetailsInternal)this).Subscription, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new CollectionsSubscriptionsMappingDetails(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new CollectionsSubscriptionsMappingDetails(content); } @@ -135,13 +145,27 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Collection name and related subscriptions list [System.ComponentModel.TypeConverter(typeof(CollectionsSubscriptionsMappingDetailsTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsSubscriptionsMappingDetails.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsSubscriptionsMappingDetails.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsSubscriptionsMappingDetails.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsSubscriptionsMappingDetails.TypeConverter.cs index 5cac41017567..0f0cecdc9800 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsSubscriptionsMappingDetails.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsSubscriptionsMappingDetails.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -15,20 +15,20 @@ public partial class CollectionsSubscriptionsMappingDetailsTypeConverter : globa { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -77,19 +77,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -101,22 +102,22 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetails ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetails ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetails).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetails).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsSubscriptionsMappingDetails.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsSubscriptionsMappingDetails.cs similarity index 77% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsSubscriptionsMappingDetails.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsSubscriptionsMappingDetails.cs index 84a7d3cfc647..9b8a03076383 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsSubscriptionsMappingDetails.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsSubscriptionsMappingDetails.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Collection name and related subscriptions list public partial class CollectionsSubscriptionsMappingDetails : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetails, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetailsInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetails, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetailsInternal { /// Backing field for property. @@ -21,11 +21,11 @@ public partial class CollectionsSubscriptionsMappingDetails : public string CollectionName { get => this._collectionName; set => this._collectionName = value; } /// Backing field for property. - private string[] _subscription; + private System.Collections.Generic.List _subscription; /// Subscriptions ids list [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public string[] Subscription { get => this._subscription; set => this._subscription = value; } + public System.Collections.Generic.List Subscription { get => this._subscription; set => this._subscription = value; } /// Creates an new instance. public CollectionsSubscriptionsMappingDetails() @@ -41,6 +41,9 @@ public partial interface ICollectionsSubscriptionsMappingDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Collection name", SerializedName = @"collectionName", PossibleTypes = new [] { typeof(string) })] @@ -49,10 +52,13 @@ public partial interface ICollectionsSubscriptionsMappingDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Subscriptions ids list", SerializedName = @"subscriptions", PossibleTypes = new [] { typeof(string) })] - string[] Subscription { get; set; } + System.Collections.Generic.List Subscription { get; set; } } /// Collection name and related subscriptions list @@ -62,7 +68,7 @@ internal partial interface ICollectionsSubscriptionsMappingDetailsInternal /// Collection name string CollectionName { get; set; } /// Subscriptions ids list - string[] Subscription { get; set; } + System.Collections.Generic.List Subscription { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsSubscriptionsMappingDetails.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsSubscriptionsMappingDetails.json.cs similarity index 86% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsSubscriptionsMappingDetails.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsSubscriptionsMappingDetails.json.cs index 44740a86498d..9038b7208e40 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsSubscriptionsMappingDetails.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsSubscriptionsMappingDetails.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class CollectionsSubscriptionsMappingDetails partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class CollectionsSubscriptionsMappingDetails /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class CollectionsSubscriptionsMappingDetails /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -63,19 +65,19 @@ internal CollectionsSubscriptionsMappingDetails(Microsoft.Azure.PowerShell.Cmdle { return; } - {_collectionName = If( json?.PropertyT("collectionName"), out var __jsonCollectionName) ? (string)__jsonCollectionName : (string)CollectionName;} - {_subscription = If( json?.PropertyT("subscriptions"), out var __jsonSubscriptions) ? If( __jsonSubscriptions as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : Subscription;} + {_collectionName = If( json?.PropertyT("collectionName"), out var __jsonCollectionName) ? (string)__jsonCollectionName : (string)_collectionName;} + {_subscription = If( json?.PropertyT("subscriptions"), out var __jsonSubscriptions) ? If( __jsonSubscriptions as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _subscription;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetails. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetails. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetails. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetails. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new CollectionsSubscriptionsMappingDetails(json) : null; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingPayload.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingPayload.PowerShell.cs similarity index 65% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingPayload.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingPayload.PowerShell.cs index a9158325ed24..c26b4335b623 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingPayload.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingPayload.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class CollectionsToSubscriptionsMappingPayload /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class CollectionsToSubscriptionsMappingPayload /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,7 +55,15 @@ public partial class CollectionsToSubscriptionsMappingPayload partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -68,17 +78,17 @@ internal CollectionsToSubscriptionsMappingPayload(global::System.Collections.IDi // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayloadInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayloadInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsToSubscriptionsMappingPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayloadInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayloadInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsToSubscriptionsMappingPropertiesTypeConverter.ConvertFrom); } if (content.Contains("SubscriptionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayloadInternal)this).SubscriptionId = (string[]) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayloadInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayloadInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayloadInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -93,39 +103,39 @@ internal CollectionsToSubscriptionsMappingPayload(global::System.Management.Auto // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayloadInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayloadInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsToSubscriptionsMappingPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayloadInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayloadInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsToSubscriptionsMappingPropertiesTypeConverter.ConvertFrom); } if (content.Contains("SubscriptionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayloadInternal)this).SubscriptionId = (string[]) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayloadInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayloadInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayloadInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new CollectionsToSubscriptionsMappingPayload(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new CollectionsToSubscriptionsMappingPayload(content); } @@ -135,13 +145,27 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The subscriptions list to get the related collections [System.ComponentModel.TypeConverter(typeof(CollectionsToSubscriptionsMappingPayloadTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingPayload.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingPayload.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingPayload.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingPayload.TypeConverter.cs index eb46f6c07286..0acd9688d280 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingPayload.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingPayload.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -15,20 +15,20 @@ public partial class CollectionsToSubscriptionsMappingPayloadTypeConverter : glo { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -77,19 +77,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -101,22 +102,22 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingPayload.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingPayload.cs similarity index 56% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingPayload.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingPayload.cs index 84098813ab0f..28e62ed0a818 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingPayload.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingPayload.cs @@ -3,29 +3,29 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// The subscriptions list to get the related collections public partial class CollectionsToSubscriptionsMappingPayload : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayloadInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayloadInternal { /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingProperties Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayloadInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsToSubscriptionsMappingProperties()); set { {_property = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingProperties Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayloadInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsToSubscriptionsMappingProperties()); set { {_property = value;} } } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingProperties _property; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingProperties _property; /// Subscriptions ids list [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsToSubscriptionsMappingProperties()); set => this._property = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsToSubscriptionsMappingProperties()); set => this._property = value; } /// Subscriptions ids list [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string[] SubscriptionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPropertiesInternal)Property).SubscriptionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPropertiesInternal)Property).SubscriptionId = value ?? null /* arrayOf */; } + public System.Collections.Generic.List SubscriptionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPropertiesInternal)Property).SubscriptionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPropertiesInternal)Property).SubscriptionId = value ?? null /* arrayOf */; } /// /// Creates an new instance. @@ -43,10 +43,13 @@ public partial interface ICollectionsToSubscriptionsMappingPayload : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Subscriptions ids list", SerializedName = @"subscriptionIds", PossibleTypes = new [] { typeof(string) })] - string[] SubscriptionId { get; set; } + System.Collections.Generic.List SubscriptionId { get; set; } } /// The subscriptions list to get the related collections @@ -54,9 +57,9 @@ internal partial interface ICollectionsToSubscriptionsMappingPayloadInternal { /// Subscriptions ids list - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingProperties Property { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingProperties Property { get; set; } /// Subscriptions ids list - string[] SubscriptionId { get; set; } + System.Collections.Generic.List SubscriptionId { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingPayload.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingPayload.json.cs similarity index 87% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingPayload.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingPayload.json.cs index 36f7b87aae32..73bdb4f43e56 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingPayload.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingPayload.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class CollectionsToSubscriptionsMappingPayload partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class CollectionsToSubscriptionsMappingPayload /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class CollectionsToSubscriptionsMappingPayload /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -63,18 +65,18 @@ internal CollectionsToSubscriptionsMappingPayload(Microsoft.Azure.PowerShell.Cmd { return; } - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsToSubscriptionsMappingProperties.FromJson(__jsonProperties) : Property;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsToSubscriptionsMappingProperties.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new CollectionsToSubscriptionsMappingPayload(json) : null; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingProperties.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingProperties.PowerShell.cs similarity index 70% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingProperties.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingProperties.PowerShell.cs index 397c7422dffb..3a0242dc1a86 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingProperties.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingProperties.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class CollectionsToSubscriptionsMappingProperties /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class CollectionsToSubscriptionsMappingProperties /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,7 +55,15 @@ public partial class CollectionsToSubscriptionsMappingProperties partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -68,13 +78,13 @@ internal CollectionsToSubscriptionsMappingProperties(global::System.Collections. // actually deserialize if (content.Contains("SubscriptionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPropertiesInternal)this).SubscriptionId = (string[]) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPropertiesInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPropertiesInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPropertiesInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -89,35 +99,35 @@ internal CollectionsToSubscriptionsMappingProperties(global::System.Management.A // actually deserialize if (content.Contains("SubscriptionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPropertiesInternal)this).SubscriptionId = (string[]) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPropertiesInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPropertiesInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPropertiesInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new CollectionsToSubscriptionsMappingProperties(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new CollectionsToSubscriptionsMappingProperties(content); } @@ -127,13 +137,27 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The subscriptions list to get the related collections [System.ComponentModel.TypeConverter(typeof(CollectionsToSubscriptionsMappingPropertiesTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingProperties.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingProperties.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingProperties.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingProperties.TypeConverter.cs index 5a2897063daa..708621e572d7 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingProperties.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingProperties.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -15,20 +15,20 @@ public partial class CollectionsToSubscriptionsMappingPropertiesTypeConverter : { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -77,19 +77,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -101,22 +102,22 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingProperties.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingProperties.cs similarity index 71% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingProperties.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingProperties.cs index 53d40dc5f4d9..d60cf2c633e3 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingProperties.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingProperties.cs @@ -3,22 +3,22 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// The subscriptions list to get the related collections public partial class CollectionsToSubscriptionsMappingProperties : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingProperties, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingProperties, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPropertiesInternal { /// Backing field for property. - private string[] _subscriptionId; + private System.Collections.Generic.List _subscriptionId; /// Subscriptions ids list [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + public System.Collections.Generic.List SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } /// /// Creates an new instance. @@ -36,10 +36,13 @@ public partial interface ICollectionsToSubscriptionsMappingProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Subscriptions ids list", SerializedName = @"subscriptionIds", PossibleTypes = new [] { typeof(string) })] - string[] SubscriptionId { get; set; } + System.Collections.Generic.List SubscriptionId { get; set; } } /// The subscriptions list to get the related collections @@ -47,7 +50,7 @@ internal partial interface ICollectionsToSubscriptionsMappingPropertiesInternal { /// Subscriptions ids list - string[] SubscriptionId { get; set; } + System.Collections.Generic.List SubscriptionId { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingProperties.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingProperties.json.cs similarity index 85% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingProperties.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingProperties.json.cs index 75916dc3da5b..d1e33fa9aaee 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingProperties.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingProperties.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class CollectionsToSubscriptionsMappingProperties partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class CollectionsToSubscriptionsMappingProperties /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class CollectionsToSubscriptionsMappingProperties /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -63,18 +65,18 @@ internal CollectionsToSubscriptionsMappingProperties(Microsoft.Azure.PowerShell. { return; } - {_subscriptionId = If( json?.PropertyT("subscriptionIds"), out var __jsonSubscriptionIds) ? If( __jsonSubscriptionIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : SubscriptionId;} + {_subscriptionId = If( json?.PropertyT("subscriptionIds"), out var __jsonSubscriptionIds) ? If( __jsonSubscriptionIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _subscriptionId;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new CollectionsToSubscriptionsMappingProperties(json) : null; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponse.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponse.PowerShell.cs similarity index 69% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponse.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponse.PowerShell.cs index 5ceaf37081fb..3be71fef63b3 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponse.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponse.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class CollectionsToSubscriptionsMappingResponse /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class CollectionsToSubscriptionsMappingResponse /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,7 +55,15 @@ public partial class CollectionsToSubscriptionsMappingResponse partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -68,13 +78,13 @@ internal CollectionsToSubscriptionsMappingResponse(global::System.Collections.ID // actually deserialize if (content.Contains("Detail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseInternal)this).Detail, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsToSubscriptionsMappingResponsePropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseProperties) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseInternal)this).Detail, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsToSubscriptionsMappingResponsePropertiesTypeConverter.ConvertFrom); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -89,35 +99,35 @@ internal CollectionsToSubscriptionsMappingResponse(global::System.Management.Aut // actually deserialize if (content.Contains("Detail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseInternal)this).Detail, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsToSubscriptionsMappingResponsePropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseProperties) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseInternal)this).Detail, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsToSubscriptionsMappingResponsePropertiesTypeConverter.ConvertFrom); } AfterDeserializePSObject(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new CollectionsToSubscriptionsMappingResponse(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new CollectionsToSubscriptionsMappingResponse(content); } @@ -127,13 +137,27 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// A map of collections subscriptions details [System.ComponentModel.TypeConverter(typeof(CollectionsToSubscriptionsMappingResponseTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponse.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponse.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponse.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponse.TypeConverter.cs index f66e1c61db6d..f9e03026b0a2 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponse.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponse.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -15,20 +15,20 @@ public partial class CollectionsToSubscriptionsMappingResponseTypeConverter : gl { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -77,19 +77,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -101,22 +102,22 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponse ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponse).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponse.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponse.cs similarity index 64% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponse.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponse.cs index bc91a3e08b49..8f0839c28281 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponse.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponse.cs @@ -3,22 +3,22 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// A map of collections subscriptions details public partial class CollectionsToSubscriptionsMappingResponse : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponse, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties _detail; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseProperties _detail; /// The map of collections subscriptions [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties Detail { get => (this._detail = this._detail ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsToSubscriptionsMappingResponseProperties()); set => this._detail = value; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseProperties Detail { get => (this._detail = this._detail ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsToSubscriptionsMappingResponseProperties()); set => this._detail = value; } /// /// Creates an new instance. @@ -36,10 +36,13 @@ public partial interface ICollectionsToSubscriptionsMappingResponse : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The map of collections subscriptions", SerializedName = @"details", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties Detail { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseProperties Detail { get; set; } } /// A map of collections subscriptions details @@ -47,7 +50,7 @@ internal partial interface ICollectionsToSubscriptionsMappingResponseInternal { /// The map of collections subscriptions - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties Detail { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseProperties Detail { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponse.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponse.json.cs similarity index 87% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponse.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponse.json.cs index cb5ead549633..494fcd4b3009 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponse.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponse.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class CollectionsToSubscriptionsMappingResponse partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class CollectionsToSubscriptionsMappingResponse /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class CollectionsToSubscriptionsMappingResponse /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -63,18 +65,18 @@ internal CollectionsToSubscriptionsMappingResponse(Microsoft.Azure.PowerShell.Cm { return; } - {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsToSubscriptionsMappingResponseProperties.FromJson(__jsonDetails) : Detail;} + {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsToSubscriptionsMappingResponseProperties.FromJson(__jsonDetails) : _detail;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponse. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponse. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new CollectionsToSubscriptionsMappingResponse(json) : null; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponseProperties.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponseProperties.PowerShell.cs similarity index 76% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponseProperties.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponseProperties.PowerShell.cs index 0bf0835433c8..9d2879d1b000 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponseProperties.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponseProperties.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -34,7 +34,8 @@ public partial class CollectionsToSubscriptionsMappingResponseProperties /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -46,7 +47,8 @@ public partial class CollectionsToSubscriptionsMappingResponseProperties /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -56,7 +58,15 @@ public partial class CollectionsToSubscriptionsMappingResponseProperties partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into a new instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -75,7 +85,7 @@ internal CollectionsToSubscriptionsMappingResponseProperties(global::System.Coll } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -94,29 +104,29 @@ internal CollectionsToSubscriptionsMappingResponseProperties(global::System.Mana } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new CollectionsToSubscriptionsMappingResponseProperties(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new CollectionsToSubscriptionsMappingResponseProperties(content); } @@ -126,13 +136,27 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Collections - subscriptions mapping details, map key is collectionId. In case subscriptions list is null or empty: no /// subscription from the list is related to that collection. diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponseProperties.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponseProperties.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponseProperties.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponseProperties.TypeConverter.cs index 9fa5ca10b882..235db4a37132 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponseProperties.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponseProperties.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -15,20 +15,20 @@ public partial class CollectionsToSubscriptionsMappingResponsePropertiesTypeConv { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -77,19 +77,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -102,8 +103,8 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . @@ -111,14 +112,14 @@ public static bool CanConvertFrom(dynamic sourceValue) /// an instance of , or null if there is no suitable /// conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponseProperties.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponseProperties.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponseProperties.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponseProperties.cs index 0808a6e940f2..625bcb031f51 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponseProperties.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponseProperties.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -12,8 +12,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 /// subscription from the list is related to that collection. /// public partial class CollectionsToSubscriptionsMappingResponseProperties : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponsePropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseProperties, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponsePropertiesInternal { /// @@ -28,7 +28,7 @@ public CollectionsToSubscriptionsMappingResponseProperties() /// subscription from the list is related to that collection. public partial interface ICollectionsToSubscriptionsMappingResponseProperties : Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray { } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponseProperties.dictionary.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponseProperties.dictionary.cs similarity index 63% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponseProperties.dictionary.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponseProperties.dictionary.cs index 136ebdce8904..617ad5e48b38 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponseProperties.dictionary.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponseProperties.dictionary.cs @@ -3,28 +3,28 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; public partial class CollectionsToSubscriptionsMappingResponseProperties : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray { - protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); - global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } - int Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + int Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } - global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } - global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetails this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetails this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } /// /// - public void Add(global::System.String key, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetails value) => __additionalProperties.Add( key, value); + public void Add(global::System.String key, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetails value) => __additionalProperties.Add( key, value); public void Clear() => __additionalProperties.Clear(); @@ -40,7 +40,7 @@ public void CopyFrom(global::System.Collections.IDictionary source) { if ((null != property.Key && null != property.Value)) { - this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); } } } @@ -55,7 +55,7 @@ public void CopyFrom(global::System.Management.Automation.PSObject source) { if ((null != property.Key && null != property.Value)) { - this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); } } } @@ -66,10 +66,10 @@ public void CopyFrom(global::System.Management.Automation.PSObject source) /// /// - public bool TryGetValue(global::System.String key, out Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsSubscriptionsMappingDetails value) => __additionalProperties.TryGetValue( key, out value); + public bool TryGetValue(global::System.String key, out Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsSubscriptionsMappingDetails value) => __additionalProperties.TryGetValue( key, out value); /// - public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsToSubscriptionsMappingResponseProperties source) => source.__additionalProperties; + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsToSubscriptionsMappingResponseProperties source) => source.__additionalProperties; } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponseProperties.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponseProperties.json.cs similarity index 85% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponseProperties.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponseProperties.json.cs index e0ff0b474b7d..07165d8fec9f 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/CollectionsToSubscriptionsMappingResponseProperties.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/CollectionsToSubscriptionsMappingResponseProperties.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -23,7 +23,7 @@ public partial class CollectionsToSubscriptionsMappingResponseProperties partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -33,7 +33,8 @@ public partial class CollectionsToSubscriptionsMappingResponseProperties /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -45,7 +46,8 @@ public partial class CollectionsToSubscriptionsMappingResponseProperties /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -68,18 +70,18 @@ internal CollectionsToSubscriptionsMappingResponseProperties(Microsoft.Azure.Pow { return; } - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray)this).AdditionalProperties, (j) => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsSubscriptionsMappingDetails.FromJson(j) ,exclusions ); + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray)this).AdditionalProperties, (j) => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsSubscriptionsMappingDetails.FromJson(j) ,exclusions ); AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponseProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new CollectionsToSubscriptionsMappingResponseProperties(json) : null; } @@ -105,7 +107,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs { return container; } - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray)this).AdditionalProperties, container); + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray)this).AdditionalProperties, container); AfterToJson(ref container); return container; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/ContextAndPlansDetails.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ContextAndPlansDetails.PowerShell.cs new file mode 100644 index 000000000000..ce39f7b342d1 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ContextAndPlansDetails.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// Object of plans per context. + [System.ComponentModel.TypeConverter(typeof(ContextAndPlansDetailsTypeConverter))] + public partial class ContextAndPlansDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ContextAndPlansDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Context")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetailsInternal)this).Context = (string) content.GetValueForProperty("Context",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetailsInternal)this).Context, global::System.Convert.ToString); + } + if (content.Contains("PlanId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetailsInternal)this).PlanId = (System.Collections.Generic.List) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetailsInternal)this).PlanId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ContextAndPlansDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Context")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetailsInternal)this).Context = (string) content.GetValueForProperty("Context",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetailsInternal)this).Context, global::System.Convert.ToString); + } + if (content.Contains("PlanId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetailsInternal)this).PlanId = (System.Collections.Generic.List) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetailsInternal)this).PlanId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ContextAndPlansDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ContextAndPlansDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Object of plans per context. + [System.ComponentModel.TypeConverter(typeof(ContextAndPlansDetailsTypeConverter))] + public partial interface IContextAndPlansDetails + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/ContextAndPlansDetails.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ContextAndPlansDetails.TypeConverter.cs new file mode 100644 index 000000000000..0154ad5c9ae6 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ContextAndPlansDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ContextAndPlansDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ContextAndPlansDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ContextAndPlansDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ContextAndPlansDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/ContextAndPlansDetails.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ContextAndPlansDetails.cs new file mode 100644 index 000000000000..bbeb997558de --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ContextAndPlansDetails.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Object of plans per context. + public partial class ContextAndPlansDetails : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetailsInternal + { + + /// Backing field for property. + private string _context; + + /// Plan's context, e.g. subscription ID, tenant ID. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string Context { get => this._context; set => this._context = value; } + + /// Backing field for property. + private System.Collections.Generic.List _planId; + + /// List of plan IDs. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List PlanId { get => this._planId; set => this._planId = value; } + + /// Creates an new instance. + public ContextAndPlansDetails() + { + + } + } + /// Object of plans per context. + public partial interface IContextAndPlansDetails : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + /// Plan's context, e.g. subscription ID, tenant ID. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Plan's context, e.g. subscription ID, tenant ID.", + SerializedName = @"context", + PossibleTypes = new [] { typeof(string) })] + string Context { get; set; } + /// List of plan IDs. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of plan IDs.", + SerializedName = @"planIds", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List PlanId { get; set; } + + } + /// Object of plans per context. + internal partial interface IContextAndPlansDetailsInternal + + { + /// Plan's context, e.g. subscription ID, tenant ID. + string Context { get; set; } + /// List of plan IDs. + System.Collections.Generic.List PlanId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/ContextAndPlansDetails.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ContextAndPlansDetails.json.cs new file mode 100644 index 000000000000..f9fcfe7538de --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ContextAndPlansDetails.json.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Object of plans per context. + public partial class ContextAndPlansDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal ContextAndPlansDetails(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_context = If( json?.PropertyT("context"), out var __jsonContext) ? (string)__jsonContext : (string)_context;} + {_planId = If( json?.PropertyT("planIds"), out var __jsonPlanIds) ? If( __jsonPlanIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _planId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new ContextAndPlansDetails(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._context)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._context.ToString()) : null, "context" ,container.Add ); + if (null != this._planId) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __x in this._planId ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("planIds",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponse.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponse.PowerShell.cs similarity index 68% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponse.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponse.PowerShell.cs index 2e18e5772edf..458634f48d42 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponse.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponse.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -34,7 +34,8 @@ public partial class ErrorResponse /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -46,7 +47,8 @@ public partial class ErrorResponse /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -56,33 +58,41 @@ public partial class ErrorResponse partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ErrorResponse(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ErrorResponse(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -97,21 +107,21 @@ internal ErrorResponse(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Error")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponseErrorTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponseErrorTypeConverter.ConvertFrom); } if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseInternal)this).Code, global::System.Convert.ToString); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseInternal)this).Message, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -126,15 +136,15 @@ internal ErrorResponse(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Error")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponseErrorTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponseErrorTypeConverter.ConvertFrom); } if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseInternal)this).Code, global::System.Convert.ToString); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseInternal)this).Message, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -143,13 +153,25 @@ internal ErrorResponse(global::System.Management.Automation.PSObject content) /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Error response indicates Microsoft.Marketplace service is not able to process the incoming request. The reason is provided /// in the error message. diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponse.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponse.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponse.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponse.TypeConverter.cs index 66ba246c2b25..e552756c2459 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponse.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponse.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class ErrorResponseTypeConverter : global::System.Management.Auto { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponse ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponse).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponse.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponse.cs similarity index 66% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponse.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponse.cs index 686e639dcd09..14e188127113 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponse.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponse.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -12,33 +12,33 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 /// in the error message. /// public partial class ErrorResponse : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponse, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseInternal { /// Error code. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseErrorInternal)Error).Code; } + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseErrorInternal)Error).Code; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseError _error; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseError _error; /// The details of the error. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseError Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponseError()); set => this._error = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseError Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponseError()); set => this._error = value; } /// Error message indicating why the operation failed. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseErrorInternal)Error).Message; } + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseErrorInternal)Error).Message; } /// Internal Acessors for Code - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseErrorInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseErrorInternal)Error).Code = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseErrorInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseErrorInternal)Error).Code = value; } /// Internal Acessors for Error - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseError Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponseError()); set { {_error = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseError Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponseError()); set { {_error = value;} } } /// Internal Acessors for Message - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseErrorInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseErrorInternal)Error).Message = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseErrorInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseErrorInternal)Error).Message = value; } /// Creates an new instance. public ErrorResponse() @@ -55,6 +55,9 @@ public partial interface IErrorResponse : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Error code.", SerializedName = @"code", PossibleTypes = new [] { typeof(string) })] @@ -63,6 +66,9 @@ public partial interface IErrorResponse : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Error message indicating why the operation failed.", SerializedName = @"message", PossibleTypes = new [] { typeof(string) })] @@ -77,7 +83,7 @@ internal partial interface IErrorResponseInternal /// Error code. string Code { get; set; } /// The details of the error. - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseError Error { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseError Error { get; set; } /// Error message indicating why the operation failed. string Message { get; set; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponse.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponse.json.cs similarity index 89% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponse.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponse.json.cs index ee0e3ce1efb0..d5bf020246aa 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponse.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponse.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -23,7 +23,7 @@ public partial class ErrorResponse partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -33,7 +33,8 @@ public partial class ErrorResponse /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -45,7 +46,8 @@ public partial class ErrorResponse /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -66,18 +68,18 @@ internal ErrorResponse(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Js { return; } - {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ErrorResponseError.FromJson(__jsonError) : Error;} + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ErrorResponseError.FromJson(__jsonError) : _error;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponse. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponse. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new ErrorResponse(json) : null; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponseError.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponseError.PowerShell.cs similarity index 71% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponseError.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponseError.PowerShell.cs index 81941ab6d2c4..3035361a8da5 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponseError.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponseError.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class ErrorResponseError /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class ErrorResponseError /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,33 +55,41 @@ public partial class ErrorResponseError partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseError DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseError DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new ErrorResponseError(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new ErrorResponseError(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -94,17 +104,17 @@ internal ErrorResponseError(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseErrorInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseErrorInternal)this).Code, global::System.Convert.ToString); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseErrorInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseErrorInternal)this).Message, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -119,11 +129,11 @@ internal ErrorResponseError(global::System.Management.Automation.PSObject conten // actually deserialize if (content.Contains("Code")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseErrorInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseErrorInternal)this).Code, global::System.Convert.ToString); } if (content.Contains("Message")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseErrorInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseErrorInternal)this).Message, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -132,13 +142,25 @@ internal ErrorResponseError(global::System.Management.Automation.PSObject conten /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The details of the error. [System.ComponentModel.TypeConverter(typeof(ErrorResponseErrorTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponseError.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponseError.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponseError.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponseError.TypeConverter.cs index 3cf9eb2cc3b8..eb470bf457d1 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponseError.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponseError.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class ErrorResponseErrorTypeConverter : global::System.Management { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseError ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseError ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseError).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseError).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponseError.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponseError.cs similarity index 83% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponseError.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponseError.cs index db4e36b5f3f5..1713779a9e82 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponseError.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponseError.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// The details of the error. public partial class ErrorResponseError : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseError, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseErrorInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseError, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseErrorInternal { /// Backing field for property. @@ -28,10 +28,10 @@ public partial class ErrorResponseError : public string Message { get => this._message; } /// Internal Acessors for Code - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseErrorInternal.Code { get => this._code; set { {_code = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseErrorInternal.Code { get => this._code; set { {_code = value;} } } /// Internal Acessors for Message - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseErrorInternal.Message { get => this._message; set { {_message = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseErrorInternal.Message { get => this._message; set { {_message = value;} } } /// Creates an new instance. public ErrorResponseError() @@ -47,6 +47,9 @@ public partial interface IErrorResponseError : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Error code.", SerializedName = @"code", PossibleTypes = new [] { typeof(string) })] @@ -55,6 +58,9 @@ public partial interface IErrorResponseError : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Error message indicating why the operation failed.", SerializedName = @"message", PossibleTypes = new [] { typeof(string) })] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponseError.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponseError.json.cs similarity index 87% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponseError.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponseError.json.cs index 54026283e63b..2abc4c87864f 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/ErrorResponseError.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/ErrorResponseError.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class ErrorResponseError partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class ErrorResponseError /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class ErrorResponseError /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -63,19 +65,19 @@ internal ErrorResponseError(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runti { return; } - {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)Code;} - {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)_code;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)_message;} AfterFromJson(json); } /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseError. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseError. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseError. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseError. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IErrorResponseError FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponseError FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new ErrorResponseError(json) : null; } @@ -99,11 +101,11 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/MarketplaceIdentity.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MarketplaceIdentity.PowerShell.cs index 5992f7342854..64c2252abd90 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/MarketplaceIdentity.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MarketplaceIdentity.PowerShell.cs @@ -30,7 +30,8 @@ public partial class MarketplaceIdentity /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -42,7 +43,8 @@ public partial class MarketplaceIdentity /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -51,6 +53,14 @@ public partial class MarketplaceIdentity partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + /// /// Deserializes a into an instance of . @@ -81,7 +91,7 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplace /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. + /// an instance of the model class. public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// @@ -170,6 +180,18 @@ internal MarketplaceIdentity(global::System.Management.Automation.PSObject conte /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } [System.ComponentModel.TypeConverter(typeof(MarketplaceIdentityTypeConverter))] public partial interface IMarketplaceIdentity diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/MarketplaceIdentity.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MarketplaceIdentity.TypeConverter.cs index 66e3d581d236..6e758b26e4e9 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/MarketplaceIdentity.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MarketplaceIdentity.TypeConverter.cs @@ -14,20 +14,20 @@ public partial class MarketplaceIdentityTypeConverter : global::System.Managemen { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -80,19 +80,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -104,8 +105,7 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/MarketplaceIdentity.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MarketplaceIdentity.cs index 8c92f0896744..5c5e555f4aea 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/MarketplaceIdentity.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MarketplaceIdentity.cs @@ -67,6 +67,9 @@ public partial interface IMarketplaceIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The admin request approval ID to get create or update", SerializedName = @"adminRequestApprovalId", PossibleTypes = new [] { typeof(string) })] @@ -75,6 +78,9 @@ public partial interface IMarketplaceIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The collection ID", SerializedName = @"collectionId", PossibleTypes = new [] { typeof(string) })] @@ -83,6 +89,9 @@ public partial interface IMarketplaceIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Resource identity path", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] @@ -91,6 +100,9 @@ public partial interface IMarketplaceIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The offer ID to update or delete", SerializedName = @"offerId", PossibleTypes = new [] { typeof(string) })] @@ -99,6 +111,9 @@ public partial interface IMarketplaceIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The store ID - must use the tenant ID", SerializedName = @"privateStoreId", PossibleTypes = new [] { typeof(string) })] @@ -107,6 +122,9 @@ public partial interface IMarketplaceIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The request approval ID to get create or update", SerializedName = @"requestApprovalId", PossibleTypes = new [] { typeof(string) })] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/MarketplaceIdentity.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MarketplaceIdentity.json.cs index 5c32c128c8ad..2af4327a1f7e 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/MarketplaceIdentity.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MarketplaceIdentity.json.cs @@ -19,7 +19,7 @@ public partial class MarketplaceIdentity partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -29,7 +29,8 @@ public partial class MarketplaceIdentity /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -41,7 +42,8 @@ public partial class MarketplaceIdentity /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -74,12 +76,12 @@ internal MarketplaceIdentity(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runt { return; } - {_privateStoreId = If( json?.PropertyT("privateStoreId"), out var __jsonPrivateStoreId) ? (string)__jsonPrivateStoreId : (string)PrivateStoreId;} - {_requestApprovalId = If( json?.PropertyT("requestApprovalId"), out var __jsonRequestApprovalId) ? (string)__jsonRequestApprovalId : (string)RequestApprovalId;} - {_adminRequestApprovalId = If( json?.PropertyT("adminRequestApprovalId"), out var __jsonAdminRequestApprovalId) ? (string)__jsonAdminRequestApprovalId : (string)AdminRequestApprovalId;} - {_offerId = If( json?.PropertyT("offerId"), out var __jsonOfferId) ? (string)__jsonOfferId : (string)OfferId;} - {_collectionId = If( json?.PropertyT("collectionId"), out var __jsonCollectionId) ? (string)__jsonCollectionId : (string)CollectionId;} - {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_privateStoreId = If( json?.PropertyT("privateStoreId"), out var __jsonPrivateStoreId) ? (string)__jsonPrivateStoreId : (string)_privateStoreId;} + {_requestApprovalId = If( json?.PropertyT("requestApprovalId"), out var __jsonRequestApprovalId) ? (string)__jsonRequestApprovalId : (string)_requestApprovalId;} + {_adminRequestApprovalId = If( json?.PropertyT("adminRequestApprovalId"), out var __jsonAdminRequestApprovalId) ? (string)__jsonAdminRequestApprovalId : (string)_adminRequestApprovalId;} + {_offerId = If( json?.PropertyT("offerId"), out var __jsonOfferId) ? (string)__jsonOfferId : (string)_offerId;} + {_collectionId = If( json?.PropertyT("collectionId"), out var __jsonCollectionId) ? (string)__jsonCollectionId : (string)_collectionId;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansPayload.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansPayload.PowerShell.cs new file mode 100644 index 000000000000..9aeec95d8655 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansPayload.PowerShell.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// Payload object for upsert offer with multiple context and plans. + [System.ComponentModel.TypeConverter(typeof(MultiContextAndPlansPayloadTypeConverter))] + public partial class MultiContextAndPlansPayload + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayload DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MultiContextAndPlansPayload(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayload DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MultiContextAndPlansPayload(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayload FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MultiContextAndPlansPayload(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayloadInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayloadInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.MultiContextAndPlansPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("OfferId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayloadInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayloadInternal)this).OfferId, global::System.Convert.ToString); + } + if (content.Contains("ETag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayloadInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayloadInternal)this).ETag, global::System.Convert.ToString); + } + if (content.Contains("PlansContext")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayloadInternal)this).PlansContext = (System.Collections.Generic.List) content.GetValueForProperty("PlansContext",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayloadInternal)this).PlansContext, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ContextAndPlansDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MultiContextAndPlansPayload(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayloadInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayloadInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.MultiContextAndPlansPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("OfferId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayloadInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayloadInternal)this).OfferId, global::System.Convert.ToString); + } + if (content.Contains("ETag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayloadInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayloadInternal)this).ETag, global::System.Convert.ToString); + } + if (content.Contains("PlansContext")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayloadInternal)this).PlansContext = (System.Collections.Generic.List) content.GetValueForProperty("PlansContext",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayloadInternal)this).PlansContext, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ContextAndPlansDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Payload object for upsert offer with multiple context and plans. + [System.ComponentModel.TypeConverter(typeof(MultiContextAndPlansPayloadTypeConverter))] + public partial interface IMultiContextAndPlansPayload + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansPayload.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansPayload.TypeConverter.cs new file mode 100644 index 000000000000..8d458f81560d --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansPayload.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MultiContextAndPlansPayloadTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayload ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayload).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MultiContextAndPlansPayload.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MultiContextAndPlansPayload.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MultiContextAndPlansPayload.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansPayload.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansPayload.cs new file mode 100644 index 000000000000..67cb76a6df5b --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansPayload.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Payload object for upsert offer with multiple context and plans. + public partial class MultiContextAndPlansPayload : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayload, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayloadInternal + { + + /// The offer's eTag. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public string ETag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPropertiesInternal)Property).ETag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPropertiesInternal)Property).ETag = value ?? null; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansProperties Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayloadInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.MultiContextAndPlansProperties()); set { {_property = value;} } } + + /// The offer ID which contains the plans. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public string OfferId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPropertiesInternal)Property).OfferId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPropertiesInternal)Property).OfferId = value ?? null; } + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public System.Collections.Generic.List PlansContext { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPropertiesInternal)Property).PlansContext; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPropertiesInternal)Property).PlansContext = value ?? null /* arrayOf */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansProperties _property; + + /// Object describes multiple context and plans. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.MultiContextAndPlansProperties()); set => this._property = value; } + + /// Creates an new instance. + public MultiContextAndPlansPayload() + { + + } + } + /// Payload object for upsert offer with multiple context and plans. + public partial interface IMultiContextAndPlansPayload : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + /// The offer's eTag. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The offer's eTag.", + SerializedName = @"eTag", + PossibleTypes = new [] { typeof(string) })] + string ETag { get; set; } + /// The offer ID which contains the plans. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The offer ID which contains the plans.", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + string OfferId { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"", + SerializedName = @"plansContext", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails) })] + System.Collections.Generic.List PlansContext { get; set; } + + } + /// Payload object for upsert offer with multiple context and plans. + internal partial interface IMultiContextAndPlansPayloadInternal + + { + /// The offer's eTag. + string ETag { get; set; } + /// The offer ID which contains the plans. + string OfferId { get; set; } + + System.Collections.Generic.List PlansContext { get; set; } + /// Object describes multiple context and plans. + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansProperties Property { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansPayload.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansPayload.json.cs new file mode 100644 index 000000000000..0cb8b0876df9 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansPayload.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Payload object for upsert offer with multiple context and plans. + public partial class MultiContextAndPlansPayload + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayload. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayload FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new MultiContextAndPlansPayload(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal MultiContextAndPlansPayload(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.MultiContextAndPlansProperties.FromJson(__jsonProperties) : _property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansProperties.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansProperties.PowerShell.cs new file mode 100644 index 000000000000..87800108012c --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansProperties.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// Object describes multiple context and plans. + [System.ComponentModel.TypeConverter(typeof(MultiContextAndPlansPropertiesTypeConverter))] + public partial class MultiContextAndPlansProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new MultiContextAndPlansProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new MultiContextAndPlansProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal MultiContextAndPlansProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPropertiesInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPropertiesInternal)this).OfferId, global::System.Convert.ToString); + } + if (content.Contains("ETag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPropertiesInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPropertiesInternal)this).ETag, global::System.Convert.ToString); + } + if (content.Contains("PlansContext")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPropertiesInternal)this).PlansContext = (System.Collections.Generic.List) content.GetValueForProperty("PlansContext",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPropertiesInternal)this).PlansContext, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ContextAndPlansDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal MultiContextAndPlansProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPropertiesInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPropertiesInternal)this).OfferId, global::System.Convert.ToString); + } + if (content.Contains("ETag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPropertiesInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPropertiesInternal)this).ETag, global::System.Convert.ToString); + } + if (content.Contains("PlansContext")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPropertiesInternal)this).PlansContext = (System.Collections.Generic.List) content.GetValueForProperty("PlansContext",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPropertiesInternal)this).PlansContext, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ContextAndPlansDetailsTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Object describes multiple context and plans. + [System.ComponentModel.TypeConverter(typeof(MultiContextAndPlansPropertiesTypeConverter))] + public partial interface IMultiContextAndPlansProperties + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansProperties.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansProperties.TypeConverter.cs new file mode 100644 index 000000000000..9c1fc02d4b3f --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansProperties.TypeConverter.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class MultiContextAndPlansPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return MultiContextAndPlansProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return MultiContextAndPlansProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return MultiContextAndPlansProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansProperties.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansProperties.cs new file mode 100644 index 000000000000..017f0dff8ce0 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansProperties.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Object describes multiple context and plans. + public partial class MultiContextAndPlansProperties : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansProperties, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPropertiesInternal + { + + /// Backing field for property. + private string _eTag; + + /// The offer's eTag. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string ETag { get => this._eTag; set => this._eTag = value; } + + /// Backing field for property. + private string _offerId; + + /// The offer ID which contains the plans. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// Backing field for property. + private System.Collections.Generic.List _plansContext; + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List PlansContext { get => this._plansContext; set => this._plansContext = value; } + + /// Creates an new instance. + public MultiContextAndPlansProperties() + { + + } + } + /// Object describes multiple context and plans. + public partial interface IMultiContextAndPlansProperties : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + /// The offer's eTag. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The offer's eTag.", + SerializedName = @"eTag", + PossibleTypes = new [] { typeof(string) })] + string ETag { get; set; } + /// The offer ID which contains the plans. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"The offer ID which contains the plans.", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + string OfferId { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"", + SerializedName = @"plansContext", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails) })] + System.Collections.Generic.List PlansContext { get; set; } + + } + /// Object describes multiple context and plans. + internal partial interface IMultiContextAndPlansPropertiesInternal + + { + /// The offer's eTag. + string ETag { get; set; } + /// The offer ID which contains the plans. + string OfferId { get; set; } + + System.Collections.Generic.List PlansContext { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansProperties.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansProperties.json.cs new file mode 100644 index 000000000000..68a3de6b4665 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/MultiContextAndPlansProperties.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Object describes multiple context and plans. + public partial class MultiContextAndPlansProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new MultiContextAndPlansProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal MultiContextAndPlansProperties(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_offerId = If( json?.PropertyT("offerId"), out var __jsonOfferId) ? (string)__jsonOfferId : (string)_offerId;} + {_eTag = If( json?.PropertyT("eTag"), out var __jsonETag) ? (string)__jsonETag : (string)_eTag;} + {_plansContext = If( json?.PropertyT("plansContext"), out var __jsonPlansContext) ? If( __jsonPlansContext as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ContextAndPlansDetails.FromJson(__u) )) ))() : null : _plansContext;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._offerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._offerId.ToString()) : null, "offerId" ,container.Add ); + AddIf( null != (((object)this._eTag)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._eTag.ToString()) : null, "eTag" ,container.Add ); + if (null != this._plansContext) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __x in this._plansContext ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("plansContext",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NewNotifications.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewNotifications.PowerShell.cs similarity index 59% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NewNotifications.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/NewNotifications.PowerShell.cs index f602f352b49f..a67ec8fdf7cb 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NewNotifications.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewNotifications.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class NewNotifications /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class NewNotifications /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,27 +55,35 @@ public partial class NewNotifications partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotifications DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotifications DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new NewNotifications(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotifications DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotifications DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new NewNotifications(content); } @@ -82,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotifications FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotifications FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -101,33 +111,33 @@ internal NewNotifications(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("OfferId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).OfferId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).OfferId, global::System.Convert.ToString); } if (content.Contains("DisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).DisplayName, global::System.Convert.ToString); } if (content.Contains("IsFuturePlansEnabled")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).IsFuturePlansEnabled = (bool?) content.GetValueForProperty("IsFuturePlansEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).IsFuturePlansEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).IsFuturePlansEnabled = (bool?) content.GetValueForProperty("IsFuturePlansEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).IsFuturePlansEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("MessageCode")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); } if (content.Contains("Icon")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).Icon = (string) content.GetValueForProperty("Icon",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).Icon, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).Icon = (string) content.GetValueForProperty("Icon",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).Icon, global::System.Convert.ToString); } if (content.Contains("Plan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).Plan = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails[]) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).Plan, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanNotificationDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).Plan = (System.Collections.Generic.List) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).Plan, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanNotificationDetailsTypeConverter.ConvertFrom)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -142,27 +152,27 @@ internal NewNotifications(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("OfferId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).OfferId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).OfferId, global::System.Convert.ToString); } if (content.Contains("DisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).DisplayName, global::System.Convert.ToString); } if (content.Contains("IsFuturePlansEnabled")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).IsFuturePlansEnabled = (bool?) content.GetValueForProperty("IsFuturePlansEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).IsFuturePlansEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).IsFuturePlansEnabled = (bool?) content.GetValueForProperty("IsFuturePlansEnabled",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).IsFuturePlansEnabled, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("MessageCode")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); } if (content.Contains("Icon")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).Icon = (string) content.GetValueForProperty("Icon",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).Icon, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).Icon = (string) content.GetValueForProperty("Icon",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).Icon, global::System.Convert.ToString); } if (content.Contains("Plan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).Plan = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails[]) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal)this).Plan, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanNotificationDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).Plan = (System.Collections.Generic.List) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal)this).Plan, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanNotificationDetailsTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } @@ -171,6 +181,18 @@ internal NewNotifications(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// New plans notification details [System.ComponentModel.TypeConverter(typeof(NewNotificationsTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NewNotifications.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewNotifications.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NewNotifications.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/NewNotifications.TypeConverter.cs index a3c93e502367..608803814350 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NewNotifications.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewNotifications.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class NewNotificationsTypeConverter : global::System.Management.A { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotifications ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotifications ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotifications).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotifications).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NewNotifications.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewNotifications.cs similarity index 82% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NewNotifications.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/NewNotifications.cs index 003fa69424df..918535943a1d 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NewNotifications.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewNotifications.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// New plans notification details public partial class NewNotifications : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotifications, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotificationsInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotifications, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotificationsInternal { /// Backing field for property. @@ -49,11 +49,11 @@ public partial class NewNotifications : public string OfferId { get => this._offerId; set => this._offerId = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails[] _plan; + private System.Collections.Generic.List _plan; /// Gets or sets removed plans notifications [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails[] Plan { get => this._plan; set => this._plan = value; } + public System.Collections.Generic.List Plan { get => this._plan; set => this._plan = value; } /// Creates an new instance. public NewNotifications() @@ -69,6 +69,9 @@ public partial interface INewNotifications : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets offer display name", SerializedName = @"displayName", PossibleTypes = new [] { typeof(string) })] @@ -77,6 +80,9 @@ public partial interface INewNotifications : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the icon url", SerializedName = @"icon", PossibleTypes = new [] { typeof(string) })] @@ -85,6 +91,9 @@ public partial interface INewNotifications : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets a value indicating whether future plans is enabled.", SerializedName = @"isFuturePlansEnabled", PossibleTypes = new [] { typeof(bool) })] @@ -93,6 +102,9 @@ public partial interface INewNotifications : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the notification message id", SerializedName = @"messageCode", PossibleTypes = new [] { typeof(long) })] @@ -101,6 +113,9 @@ public partial interface INewNotifications : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets offer id", SerializedName = @"offerId", PossibleTypes = new [] { typeof(string) })] @@ -109,10 +124,13 @@ public partial interface INewNotifications : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets removed plans notifications", SerializedName = @"plans", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails[] Plan { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetails) })] + System.Collections.Generic.List Plan { get; set; } } /// New plans notification details @@ -130,7 +148,7 @@ internal partial interface INewNotificationsInternal /// Gets offer id string OfferId { get; set; } /// Gets or sets removed plans notifications - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails[] Plan { get; set; } + System.Collections.Generic.List Plan { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NewNotifications.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewNotifications.json.cs similarity index 86% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NewNotifications.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/NewNotifications.json.cs index bba2e2103333..6dc3e112fa62 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NewNotifications.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewNotifications.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class NewNotifications partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class NewNotifications /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class NewNotifications /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class NewNotifications partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotifications. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotifications. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotifications. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotifications. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotifications FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotifications FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new NewNotifications(json) : null; } @@ -75,12 +77,12 @@ internal NewNotifications(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime { return; } - {_offerId = If( json?.PropertyT("offerId"), out var __jsonOfferId) ? (string)__jsonOfferId : (string)OfferId;} - {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)DisplayName;} - {_isFuturePlansEnabled = If( json?.PropertyT("isFuturePlansEnabled"), out var __jsonIsFuturePlansEnabled) ? (bool?)__jsonIsFuturePlansEnabled : IsFuturePlansEnabled;} - {_messageCode = If( json?.PropertyT("messageCode"), out var __jsonMessageCode) ? (long?)__jsonMessageCode : MessageCode;} - {_icon = If( json?.PropertyT("icon"), out var __jsonIcon) ? (string)__jsonIcon : (string)Icon;} - {_plan = If( json?.PropertyT("plans"), out var __jsonPlans) ? If( __jsonPlans as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanNotificationDetails.FromJson(__u) )) ))() : null : Plan;} + {_offerId = If( json?.PropertyT("offerId"), out var __jsonOfferId) ? (string)__jsonOfferId : (string)_offerId;} + {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)_displayName;} + {_isFuturePlansEnabled = If( json?.PropertyT("isFuturePlansEnabled"), out var __jsonIsFuturePlansEnabled) ? (bool?)__jsonIsFuturePlansEnabled : _isFuturePlansEnabled;} + {_messageCode = If( json?.PropertyT("messageCode"), out var __jsonMessageCode) ? (long?)__jsonMessageCode : _messageCode;} + {_icon = If( json?.PropertyT("icon"), out var __jsonIcon) ? (string)__jsonIcon : (string)_icon;} + {_plan = If( json?.PropertyT("plans"), out var __jsonPlans) ? If( __jsonPlans as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanNotificationDetails.FromJson(__u) )) ))() : null : _plan;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewPlansNotificationsList.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewPlansNotificationsList.PowerShell.cs new file mode 100644 index 000000000000..0117dce02ab8 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewPlansNotificationsList.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// List of all new plans notifications for public offers + [System.ComponentModel.TypeConverter(typeof(NewPlansNotificationsListTypeConverter))] + public partial class NewPlansNotificationsList + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsList DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NewPlansNotificationsList(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NewPlansNotificationsList(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NewPlansNotificationsList(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NewPlansNotification")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsListInternal)this).NewPlansNotification = (System.Collections.Generic.List) content.GetValueForProperty("NewPlansNotification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsListInternal)this).NewPlansNotification, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.NewNotificationsTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NewPlansNotificationsList(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NewPlansNotification")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsListInternal)this).NewPlansNotification = (System.Collections.Generic.List) content.GetValueForProperty("NewPlansNotification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsListInternal)this).NewPlansNotification, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.NewNotificationsTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// List of all new plans notifications for public offers + [System.ComponentModel.TypeConverter(typeof(NewPlansNotificationsListTypeConverter))] + public partial interface INewPlansNotificationsList + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewPlansNotificationsList.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewPlansNotificationsList.TypeConverter.cs new file mode 100644 index 000000000000..d60c1c9f3926 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewPlansNotificationsList.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NewPlansNotificationsListTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsList ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsList).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NewPlansNotificationsList.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NewPlansNotificationsList.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NewPlansNotificationsList.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewPlansNotificationsList.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewPlansNotificationsList.cs new file mode 100644 index 000000000000..65e9c60734b4 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewPlansNotificationsList.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// List of all new plans notifications for public offers + public partial class NewPlansNotificationsList : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsList, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsListInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _newPlansNotification; + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List NewPlansNotification { get => this._newPlansNotification; set => this._newPlansNotification = value; } + + /// Creates an new instance. + public NewPlansNotificationsList() + { + + } + } + /// List of all new plans notifications for public offers + public partial interface INewPlansNotificationsList : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"", + SerializedName = @"newPlansNotifications", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotifications) })] + System.Collections.Generic.List NewPlansNotification { get; set; } + + } + /// List of all new plans notifications for public offers + internal partial interface INewPlansNotificationsListInternal + + { + System.Collections.Generic.List NewPlansNotification { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewPlansNotificationsList.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewPlansNotificationsList.json.cs new file mode 100644 index 000000000000..090b27161bea --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NewPlansNotificationsList.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// List of all new plans notifications for public offers + public partial class NewPlansNotificationsList + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsList. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsList. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsList FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new NewPlansNotificationsList(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal NewPlansNotificationsList(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_newPlansNotification = If( json?.PropertyT("newPlansNotifications"), out var __jsonNewPlansNotifications) ? If( __jsonNewPlansNotifications as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotifications) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.NewNotifications.FromJson(__u) )) ))() : null : _newPlansNotification;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._newPlansNotification) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __x in this._newPlansNotification ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("newPlansNotifications",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NotificationsSettingsProperties.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NotificationsSettingsProperties.PowerShell.cs similarity index 65% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NotificationsSettingsProperties.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/NotificationsSettingsProperties.PowerShell.cs index f1d662acd410..6be96b382ab4 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NotificationsSettingsProperties.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NotificationsSettingsProperties.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class NotificationsSettingsProperties /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class NotificationsSettingsProperties /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,29 +55,35 @@ public partial class NotificationsSettingsProperties partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new NotificationsSettingsProperties(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new NotificationsSettingsProperties(content); } @@ -84,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,17 +111,17 @@ internal NotificationsSettingsProperties(global::System.Collections.IDictionary // actually deserialize if (content.Contains("Recipient")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsPropertiesInternal)this).Recipient = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[]) content.GetValueForProperty("Recipient",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsPropertiesInternal)this).Recipient, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RecipientTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsPropertiesInternal)this).Recipient = (System.Collections.Generic.List) content.GetValueForProperty("Recipient",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsPropertiesInternal)this).Recipient, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RecipientTypeConverter.ConvertFrom)); } if (content.Contains("SendToAllMarketplaceAdmin")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsPropertiesInternal)this).SendToAllMarketplaceAdmin = (bool?) content.GetValueForProperty("SendToAllMarketplaceAdmin",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsPropertiesInternal)this).SendToAllMarketplaceAdmin, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsPropertiesInternal)this).SendToAllMarketplaceAdmin = (bool?) content.GetValueForProperty("SendToAllMarketplaceAdmin",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsPropertiesInternal)this).SendToAllMarketplaceAdmin, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -128,11 +136,11 @@ internal NotificationsSettingsProperties(global::System.Management.Automation.PS // actually deserialize if (content.Contains("Recipient")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsPropertiesInternal)this).Recipient = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[]) content.GetValueForProperty("Recipient",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsPropertiesInternal)this).Recipient, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RecipientTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsPropertiesInternal)this).Recipient = (System.Collections.Generic.List) content.GetValueForProperty("Recipient",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsPropertiesInternal)this).Recipient, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RecipientTypeConverter.ConvertFrom)); } if (content.Contains("SendToAllMarketplaceAdmin")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsPropertiesInternal)this).SendToAllMarketplaceAdmin = (bool?) content.GetValueForProperty("SendToAllMarketplaceAdmin",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsPropertiesInternal)this).SendToAllMarketplaceAdmin, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsPropertiesInternal)this).SendToAllMarketplaceAdmin = (bool?) content.GetValueForProperty("SendToAllMarketplaceAdmin",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsPropertiesInternal)this).SendToAllMarketplaceAdmin, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } AfterDeserializePSObject(content); } @@ -141,6 +149,18 @@ internal NotificationsSettingsProperties(global::System.Management.Automation.PS /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Describes the json payload for notifications settings [System.ComponentModel.TypeConverter(typeof(NotificationsSettingsPropertiesTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NotificationsSettingsProperties.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NotificationsSettingsProperties.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NotificationsSettingsProperties.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/NotificationsSettingsProperties.TypeConverter.cs index 33d6b258dc90..acfc3868db8e 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NotificationsSettingsProperties.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NotificationsSettingsProperties.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class NotificationsSettingsPropertiesTypeConverter : global::Syst { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,21 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NotificationsSettingsProperties.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NotificationsSettingsProperties.cs similarity index 75% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NotificationsSettingsProperties.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/NotificationsSettingsProperties.cs index 69217b5f1b02..d977317aebf1 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NotificationsSettingsProperties.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NotificationsSettingsProperties.cs @@ -3,22 +3,22 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Describes the json payload for notifications settings public partial class NotificationsSettingsProperties : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsProperties, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsPropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsProperties, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsPropertiesInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[] _recipient; + private System.Collections.Generic.List _recipient; /// Gets or sets list of notified recipients for new requests [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[] Recipient { get => this._recipient; set => this._recipient = value; } + public System.Collections.Generic.List Recipient { get => this._recipient; set => this._recipient = value; } /// Backing field for property. private bool? _sendToAllMarketplaceAdmin; @@ -41,14 +41,20 @@ public partial interface INotificationsSettingsProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets list of notified recipients for new requests", SerializedName = @"recipients", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[] Recipient { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient) })] + System.Collections.Generic.List Recipient { get; set; } /// Gets or sets whether to send email to all marketplace admins for new requests [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets whether to send email to all marketplace admins for new requests", SerializedName = @"sendToAllMarketplaceAdmins", PossibleTypes = new [] { typeof(bool) })] @@ -60,7 +66,7 @@ internal partial interface INotificationsSettingsPropertiesInternal { /// Gets or sets list of notified recipients for new requests - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[] Recipient { get; set; } + System.Collections.Generic.List Recipient { get; set; } /// Gets or sets whether to send email to all marketplace admins for new requests bool? SendToAllMarketplaceAdmin { get; set; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NotificationsSettingsProperties.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NotificationsSettingsProperties.json.cs similarity index 85% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NotificationsSettingsProperties.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/NotificationsSettingsProperties.json.cs index b88b234ed57d..9720cdff56f3 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/NotificationsSettingsProperties.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/NotificationsSettingsProperties.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class NotificationsSettingsProperties partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class NotificationsSettingsProperties /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class NotificationsSettingsProperties /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class NotificationsSettingsProperties partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new NotificationsSettingsProperties(json) : null; } @@ -75,8 +77,8 @@ internal NotificationsSettingsProperties(Microsoft.Azure.PowerShell.Cmdlets.Mark { return; } - {_recipient = If( json?.PropertyT("recipients"), out var __jsonRecipients) ? If( __jsonRecipients as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Recipient.FromJson(__u) )) ))() : null : Recipient;} - {_sendToAllMarketplaceAdmin = If( json?.PropertyT("sendToAllMarketplaceAdmins"), out var __jsonSendToAllMarketplaceAdmins) ? (bool?)__jsonSendToAllMarketplaceAdmins : SendToAllMarketplaceAdmin;} + {_recipient = If( json?.PropertyT("recipients"), out var __jsonRecipients) ? If( __jsonRecipients as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Recipient.FromJson(__u) )) ))() : null : _recipient;} + {_sendToAllMarketplaceAdmin = If( json?.PropertyT("sendToAllMarketplaceAdmins"), out var __jsonSendToAllMarketplaceAdmins) ? (bool?)__jsonSendToAllMarketplaceAdmins : _sendToAllMarketplaceAdmin;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Offer.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Offer.PowerShell.cs new file mode 100644 index 000000000000..54bc239b5934 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Offer.PowerShell.cs @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// The privateStore offer data structure. + [System.ComponentModel.TypeConverter(typeof(OfferTypeConverter))] + public partial class Offer + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Offer(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Offer(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Offer(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("UniqueOfferId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).UniqueOfferId = (string) content.GetValueForProperty("UniqueOfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).UniqueOfferId, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("PublisherDisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).PublisherDisplayName = (string) content.GetValueForProperty("PublisherDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).PublisherDisplayName, global::System.Convert.ToString); + } + if (content.Contains("ETag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).ETag, global::System.Convert.ToString); + } + if (content.Contains("PrivateStoreId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).PrivateStoreId = (string) content.GetValueForProperty("PrivateStoreId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).PrivateStoreId, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).CreatedAt = (string) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).CreatedAt, global::System.Convert.ToString); + } + if (content.Contains("ModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).ModifiedAt = (string) content.GetValueForProperty("ModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).ModifiedAt, global::System.Convert.ToString); + } + if (content.Contains("SpecificPlanIdsLimitation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).SpecificPlanIdsLimitation = (System.Collections.Generic.List) content.GetValueForProperty("SpecificPlanIdsLimitation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).SpecificPlanIdsLimitation, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("UpdateSuppressedDueIdempotence")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).UpdateSuppressedDueIdempotence = (bool?) content.GetValueForProperty("UpdateSuppressedDueIdempotence",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).UpdateSuppressedDueIdempotence, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IconFileUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).IconFileUri = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris) content.GetValueForProperty("IconFileUri",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).IconFileUri, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferPropertiesIconFileUrisTypeConverter.ConvertFrom); + } + if (content.Contains("Plan")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).Plan = (System.Collections.Generic.List) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).Plan, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Offer(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("UniqueOfferId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).UniqueOfferId = (string) content.GetValueForProperty("UniqueOfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).UniqueOfferId, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("PublisherDisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).PublisherDisplayName = (string) content.GetValueForProperty("PublisherDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).PublisherDisplayName, global::System.Convert.ToString); + } + if (content.Contains("ETag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).ETag, global::System.Convert.ToString); + } + if (content.Contains("PrivateStoreId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).PrivateStoreId = (string) content.GetValueForProperty("PrivateStoreId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).PrivateStoreId, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).CreatedAt = (string) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).CreatedAt, global::System.Convert.ToString); + } + if (content.Contains("ModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).ModifiedAt = (string) content.GetValueForProperty("ModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).ModifiedAt, global::System.Convert.ToString); + } + if (content.Contains("SpecificPlanIdsLimitation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).SpecificPlanIdsLimitation = (System.Collections.Generic.List) content.GetValueForProperty("SpecificPlanIdsLimitation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).SpecificPlanIdsLimitation, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("UpdateSuppressedDueIdempotence")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).UpdateSuppressedDueIdempotence = (bool?) content.GetValueForProperty("UpdateSuppressedDueIdempotence",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).UpdateSuppressedDueIdempotence, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("IconFileUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).IconFileUri = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris) content.GetValueForProperty("IconFileUri",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).IconFileUri, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferPropertiesIconFileUrisTypeConverter.ConvertFrom); + } + if (content.Contains("Plan")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).Plan = (System.Collections.Generic.List) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal)this).Plan, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The privateStore offer data structure. + [System.ComponentModel.TypeConverter(typeof(OfferTypeConverter))] + public partial interface IOffer + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Offer.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Offer.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Offer.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/Offer.TypeConverter.cs index 7b6f56319d76..177111e864f6 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Offer.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Offer.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,19 @@ public partial class OfferTypeConverter : global::System.Management.Automation.P { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +74,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +99,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Offer.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Offer.cs similarity index 59% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Offer.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/Offer.cs index d5587b7c1383..8fc98defbcd7 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Offer.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Offer.cs @@ -3,148 +3,151 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// The privateStore offer data structure. public partial class Offer : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IValidates { /// - /// Backing field for Inherited model + /// Backing field for Inherited model /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Resource(); + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Resource(); /// Private store offer creation date [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string CreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).CreatedAt; } + public string CreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).CreatedAt; } /// It will be displayed prominently in the marketplace [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).OfferDisplayName; } + public string DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).OfferDisplayName; } /// Identifier for purposes of race condition [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string ETag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).ETag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).ETag = value ?? null; } + public string ETag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).ETag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).ETag = value ?? null; } /// Icon File Uris [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris IconFileUri { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).IconFileUri; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).IconFileUri = value ?? null /* model class */; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris IconFileUri { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).IconFileUri; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).IconFileUri = value ?? null /* model class */; } /// The resource ID. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Id; } + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Id; } /// Internal Acessors for CreatedAt - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal.CreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).CreatedAt = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal.CreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).CreatedAt = value; } /// Internal Acessors for DisplayName - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal.DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).OfferDisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).OfferDisplayName = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal.DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).OfferDisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).OfferDisplayName = value; } /// Internal Acessors for ModifiedAt - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal.ModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).ModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).ModifiedAt = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal.ModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).ModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).ModifiedAt = value; } /// Internal Acessors for PrivateStoreId - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal.PrivateStoreId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).PrivateStoreId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).PrivateStoreId = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal.PrivateStoreId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).PrivateStoreId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).PrivateStoreId = value; } /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferProperties()); set { {_property = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferProperties()); set { {_property = value;} } } /// Internal Acessors for PublisherDisplayName - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal.PublisherDisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).PublisherDisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).PublisherDisplayName = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal.PublisherDisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).PublisherDisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).PublisherDisplayName = value; } /// Internal Acessors for UniqueOfferId - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferInternal.UniqueOfferId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).UniqueOfferId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).UniqueOfferId = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferInternal.UniqueOfferId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).UniqueOfferId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).UniqueOfferId = value; } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Id = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Id = value; } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Name = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Name = value; } /// Internal Acessors for SystemData - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemData = value; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemData = value; } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Type = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Type = value; } /// Private store offer modification date [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string ModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).ModifiedAt; } + public string ModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).ModifiedAt; } /// The name of the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Name; } + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Name; } /// Offer plans [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan[] Plan { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).Plan; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).Plan = value ?? null /* arrayOf */; } + public System.Collections.Generic.List Plan { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).Plan; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).Plan = value ?? null /* arrayOf */; } /// Private store unique id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string PrivateStoreId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).PrivateStoreId; } + public string PrivateStoreId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).PrivateStoreId; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties _property; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties _property; /// The privateStore offer data structure. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferProperties()); set => this._property = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferProperties()); set => this._property = value; } /// Publisher name that will be displayed prominently in the marketplace [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string PublisherDisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).PublisherDisplayName; } + public string PublisherDisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).PublisherDisplayName; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } /// Plan ids limitation for this offer [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string[] SpecificPlanIdsLimitation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).SpecificPlanIdsLimitation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).SpecificPlanIdsLimitation = value ?? null /* arrayOf */; } + public System.Collections.Generic.List SpecificPlanIdsLimitation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).SpecificPlanIdsLimitation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).SpecificPlanIdsLimitation = value ?? null /* arrayOf */; } /// Metadata pertaining to creation and last modification of the resource [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemData; } + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemData; } /// The timestamp of resource creation (UTC) [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } /// The identity that created the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedBy = value ?? null; } + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedBy = value ?? null; } /// The type of identity that created the resource [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType)""); } + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedByType = value ?? null; } /// The timestamp of resource last modification (UTC) [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } /// The identity that last modified the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedBy = value ?? null; } + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedBy = value ?? null; } /// The type of identity that last modified the resource [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType)""); } + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedByType = value ?? null; } /// The type of the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Type; } + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Type; } /// Offers unique id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string UniqueOfferId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).UniqueOfferId; } + public string UniqueOfferId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).UniqueOfferId; } /// /// Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed /// one in db, the offer would not be updated. /// [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public bool? UpdateSuppressedDueIdempotence { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).UpdateSuppressedDueIdempotence; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)Property).UpdateSuppressedDueIdempotence = value ?? default(bool); } + public bool? UpdateSuppressedDueIdempotence { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).UpdateSuppressedDueIdempotence; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)Property).UpdateSuppressedDueIdempotence = value ?? default(bool); } /// Creates an new instance. public Offer() @@ -156,7 +159,7 @@ public Offer() /// an instance that will receive validation /// events. /// - /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// A that will be complete when validation is completed. /// public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { @@ -167,12 +170,15 @@ public Offer() /// The privateStore offer data structure. public partial interface IOffer : Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResource + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResource { /// Private store offer creation date [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Private store offer creation date", SerializedName = @"createdAt", PossibleTypes = new [] { typeof(string) })] @@ -181,6 +187,9 @@ public partial interface IOffer : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"It will be displayed prominently in the marketplace", SerializedName = @"offerDisplayName", PossibleTypes = new [] { typeof(string) })] @@ -189,6 +198,9 @@ public partial interface IOffer : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Identifier for purposes of race condition", SerializedName = @"eTag", PossibleTypes = new [] { typeof(string) })] @@ -197,14 +209,20 @@ public partial interface IOffer : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Icon File Uris", SerializedName = @"iconFileUris", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris IconFileUri { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris) })] + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris IconFileUri { get; set; } /// Private store offer modification date [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Private store offer modification date", SerializedName = @"modifiedAt", PossibleTypes = new [] { typeof(string) })] @@ -213,14 +231,20 @@ public partial interface IOffer : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Offer plans", SerializedName = @"plans", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan[] Plan { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan) })] + System.Collections.Generic.List Plan { get; set; } /// Private store unique id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Private store unique id", SerializedName = @"privateStoreId", PossibleTypes = new [] { typeof(string) })] @@ -229,6 +253,9 @@ public partial interface IOffer : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Publisher name that will be displayed prominently in the marketplace", SerializedName = @"publisherDisplayName", PossibleTypes = new [] { typeof(string) })] @@ -237,14 +264,20 @@ public partial interface IOffer : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Plan ids limitation for this offer", SerializedName = @"specificPlanIdsLimitation", PossibleTypes = new [] { typeof(string) })] - string[] SpecificPlanIdsLimitation { get; set; } + System.Collections.Generic.List SpecificPlanIdsLimitation { get; set; } /// Offers unique id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Offers unique id", SerializedName = @"uniqueOfferId", PossibleTypes = new [] { typeof(string) })] @@ -256,6 +289,9 @@ public partial interface IOffer : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated.", SerializedName = @"updateSuppressedDueIdempotence", PossibleTypes = new [] { typeof(bool) })] @@ -264,7 +300,7 @@ public partial interface IOffer : } /// The privateStore offer data structure. internal partial interface IOfferInternal : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal { /// Private store offer creation date string CreatedAt { get; set; } @@ -273,19 +309,19 @@ internal partial interface IOfferInternal : /// Identifier for purposes of race condition string ETag { get; set; } /// Icon File Uris - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris IconFileUri { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris IconFileUri { get; set; } /// Private store offer modification date string ModifiedAt { get; set; } /// Offer plans - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan[] Plan { get; set; } + System.Collections.Generic.List Plan { get; set; } /// Private store unique id string PrivateStoreId { get; set; } /// The privateStore offer data structure. - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties Property { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties Property { get; set; } /// Publisher name that will be displayed prominently in the marketplace string PublisherDisplayName { get; set; } /// Plan ids limitation for this offer - string[] SpecificPlanIdsLimitation { get; set; } + System.Collections.Generic.List SpecificPlanIdsLimitation { get; set; } /// Offers unique id string UniqueOfferId { get; set; } /// diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Offer.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Offer.json.cs similarity index 87% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Offer.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/Offer.json.cs index 68e06946ba0e..eb0c41fa06ab 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Offer.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Offer.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class Offer partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class Offer /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class Offer /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,11 @@ public partial class Offer partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new Offer(json) : null; } @@ -75,8 +75,8 @@ internal Offer(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonO { return; } - __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Resource(json); - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferProperties.FromJson(__jsonProperties) : Property;} + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferProperties.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferListResponse.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferListResponse.PowerShell.cs similarity index 67% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferListResponse.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferListResponse.PowerShell.cs index 7f54aab7bf64..6ab83b6754d4 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferListResponse.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferListResponse.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -30,7 +30,8 @@ public partial class OfferListResponse /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -42,7 +43,8 @@ public partial class OfferListResponse /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -52,27 +54,35 @@ public partial class OfferListResponse partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferListResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new OfferListResponse(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferListResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new OfferListResponse(content); } @@ -81,11 +91,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferListResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -100,17 +110,17 @@ internal OfferListResponse(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferListResponseInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferListResponseInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponseInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -125,11 +135,11 @@ internal OfferListResponse(global::System.Management.Automation.PSObject content // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferListResponseInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferListResponseInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponseInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -138,6 +148,18 @@ internal OfferListResponse(global::System.Management.Automation.PSObject content /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } [System.ComponentModel.TypeConverter(typeof(OfferListResponseTypeConverter))] public partial interface IOfferListResponse diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferListResponse.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferListResponse.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferListResponse.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferListResponse.TypeConverter.cs index c180b8242580..53908138c6ef 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferListResponse.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferListResponse.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class OfferListResponseTypeConverter : global::System.Management. { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferListResponse ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponse ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferListResponse).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponse).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferListResponse.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferListResponse.cs similarity index 70% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferListResponse.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferListResponse.cs index fcc60eb810fc..328027f776eb 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferListResponse.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferListResponse.cs @@ -3,13 +3,13 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; public partial class OfferListResponse : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferListResponse, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferListResponseInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponse, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponseInternal { /// Backing field for property. @@ -20,10 +20,10 @@ public partial class OfferListResponse : public string NextLink { get => this._nextLink; set => this._nextLink = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer[] _value; + private System.Collections.Generic.List _value; [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer[] Value { get => this._value; set => this._value = value; } + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } /// Creates an new instance. public OfferListResponse() @@ -38,6 +38,9 @@ public partial interface IOfferListResponse : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"URL to get the next set of offer list results if there are any.", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -46,10 +49,13 @@ public partial interface IOfferListResponse : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer[] Value { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer) })] + System.Collections.Generic.List Value { get; set; } } internal partial interface IOfferListResponseInternal @@ -58,7 +64,7 @@ internal partial interface IOfferListResponseInternal /// URL to get the next set of offer list results if there are any. string NextLink { get; set; } - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferListResponse.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferListResponse.json.cs similarity index 85% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferListResponse.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferListResponse.json.cs index 3e91e0bdf4d9..7d2ff3479166 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferListResponse.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferListResponse.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -19,7 +19,7 @@ public partial class OfferListResponse partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -29,7 +29,8 @@ public partial class OfferListResponse /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -41,7 +42,8 @@ public partial class OfferListResponse /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -51,13 +53,13 @@ public partial class OfferListResponse partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferListResponse. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponse. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferListResponse. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponse. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferListResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new OfferListResponse(json) : null; } @@ -74,8 +76,8 @@ internal OfferListResponse(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtim { return; } - {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Offer.FromJson(__u) )) ))() : null : Value;} - {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Offer.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferProperties.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferProperties.PowerShell.cs similarity index 53% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferProperties.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferProperties.PowerShell.cs index e6995760c848..d5c497ecf917 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferProperties.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferProperties.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -30,7 +30,8 @@ public partial class OfferProperties /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -42,7 +43,8 @@ public partial class OfferProperties /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -52,27 +54,35 @@ public partial class OfferProperties partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new OfferProperties(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new OfferProperties(content); } @@ -81,11 +91,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -100,53 +110,53 @@ internal OfferProperties(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("UniqueOfferId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).UniqueOfferId = (string) content.GetValueForProperty("UniqueOfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).UniqueOfferId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).UniqueOfferId = (string) content.GetValueForProperty("UniqueOfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).UniqueOfferId, global::System.Convert.ToString); } if (content.Contains("OfferDisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).OfferDisplayName = (string) content.GetValueForProperty("OfferDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).OfferDisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).OfferDisplayName = (string) content.GetValueForProperty("OfferDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).OfferDisplayName, global::System.Convert.ToString); } if (content.Contains("PublisherDisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).PublisherDisplayName = (string) content.GetValueForProperty("PublisherDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).PublisherDisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).PublisherDisplayName = (string) content.GetValueForProperty("PublisherDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).PublisherDisplayName, global::System.Convert.ToString); } if (content.Contains("ETag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).ETag, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).ETag, global::System.Convert.ToString); } if (content.Contains("PrivateStoreId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).PrivateStoreId = (string) content.GetValueForProperty("PrivateStoreId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).PrivateStoreId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).PrivateStoreId = (string) content.GetValueForProperty("PrivateStoreId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).PrivateStoreId, global::System.Convert.ToString); } if (content.Contains("CreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).CreatedAt = (string) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).CreatedAt, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).CreatedAt = (string) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).CreatedAt, global::System.Convert.ToString); } if (content.Contains("ModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).ModifiedAt = (string) content.GetValueForProperty("ModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).ModifiedAt, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).ModifiedAt = (string) content.GetValueForProperty("ModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).ModifiedAt, global::System.Convert.ToString); } if (content.Contains("SpecificPlanIdsLimitation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).SpecificPlanIdsLimitation = (string[]) content.GetValueForProperty("SpecificPlanIdsLimitation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).SpecificPlanIdsLimitation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).SpecificPlanIdsLimitation = (System.Collections.Generic.List) content.GetValueForProperty("SpecificPlanIdsLimitation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).SpecificPlanIdsLimitation, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("UpdateSuppressedDueIdempotence")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).UpdateSuppressedDueIdempotence = (bool?) content.GetValueForProperty("UpdateSuppressedDueIdempotence",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).UpdateSuppressedDueIdempotence, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).UpdateSuppressedDueIdempotence = (bool?) content.GetValueForProperty("UpdateSuppressedDueIdempotence",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).UpdateSuppressedDueIdempotence, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("IconFileUri")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).IconFileUri = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris) content.GetValueForProperty("IconFileUri",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).IconFileUri, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferPropertiesIconFileUrisTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).IconFileUri = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris) content.GetValueForProperty("IconFileUri",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).IconFileUri, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferPropertiesIconFileUrisTypeConverter.ConvertFrom); } if (content.Contains("Plan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).Plan = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan[]) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).Plan, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).Plan = (System.Collections.Generic.List) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).Plan, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanTypeConverter.ConvertFrom)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -161,47 +171,47 @@ internal OfferProperties(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("UniqueOfferId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).UniqueOfferId = (string) content.GetValueForProperty("UniqueOfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).UniqueOfferId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).UniqueOfferId = (string) content.GetValueForProperty("UniqueOfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).UniqueOfferId, global::System.Convert.ToString); } if (content.Contains("OfferDisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).OfferDisplayName = (string) content.GetValueForProperty("OfferDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).OfferDisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).OfferDisplayName = (string) content.GetValueForProperty("OfferDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).OfferDisplayName, global::System.Convert.ToString); } if (content.Contains("PublisherDisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).PublisherDisplayName = (string) content.GetValueForProperty("PublisherDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).PublisherDisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).PublisherDisplayName = (string) content.GetValueForProperty("PublisherDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).PublisherDisplayName, global::System.Convert.ToString); } if (content.Contains("ETag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).ETag, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).ETag, global::System.Convert.ToString); } if (content.Contains("PrivateStoreId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).PrivateStoreId = (string) content.GetValueForProperty("PrivateStoreId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).PrivateStoreId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).PrivateStoreId = (string) content.GetValueForProperty("PrivateStoreId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).PrivateStoreId, global::System.Convert.ToString); } if (content.Contains("CreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).CreatedAt = (string) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).CreatedAt, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).CreatedAt = (string) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).CreatedAt, global::System.Convert.ToString); } if (content.Contains("ModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).ModifiedAt = (string) content.GetValueForProperty("ModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).ModifiedAt, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).ModifiedAt = (string) content.GetValueForProperty("ModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).ModifiedAt, global::System.Convert.ToString); } if (content.Contains("SpecificPlanIdsLimitation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).SpecificPlanIdsLimitation = (string[]) content.GetValueForProperty("SpecificPlanIdsLimitation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).SpecificPlanIdsLimitation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).SpecificPlanIdsLimitation = (System.Collections.Generic.List) content.GetValueForProperty("SpecificPlanIdsLimitation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).SpecificPlanIdsLimitation, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("UpdateSuppressedDueIdempotence")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).UpdateSuppressedDueIdempotence = (bool?) content.GetValueForProperty("UpdateSuppressedDueIdempotence",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).UpdateSuppressedDueIdempotence, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).UpdateSuppressedDueIdempotence = (bool?) content.GetValueForProperty("UpdateSuppressedDueIdempotence",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).UpdateSuppressedDueIdempotence, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("IconFileUri")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).IconFileUri = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris) content.GetValueForProperty("IconFileUri",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).IconFileUri, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferPropertiesIconFileUrisTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).IconFileUri = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris) content.GetValueForProperty("IconFileUri",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).IconFileUri, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferPropertiesIconFileUrisTypeConverter.ConvertFrom); } if (content.Contains("Plan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).Plan = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan[]) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal)this).Plan, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).Plan = (System.Collections.Generic.List) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal)this).Plan, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } @@ -210,6 +220,18 @@ internal OfferProperties(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } [System.ComponentModel.TypeConverter(typeof(OfferPropertiesTypeConverter))] public partial interface IOfferProperties diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferProperties.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferProperties.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferProperties.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferProperties.TypeConverter.cs index 7575a74fbd3a..700b3373dec6 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferProperties.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferProperties.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class OfferPropertiesTypeConverter : global::System.Management.Au { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferProperties.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferProperties.cs similarity index 78% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferProperties.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferProperties.cs index 1445236d8f99..1e6e7032fe7d 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferProperties.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferProperties.cs @@ -3,13 +3,13 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; public partial class OfferProperties : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal { /// Backing field for property. @@ -27,29 +27,29 @@ public partial class OfferProperties : public string ETag { get => this._eTag; set => this._eTag = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris _iconFileUri; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris _iconFileUri; /// Icon File Uris [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris IconFileUri { get => (this._iconFileUri = this._iconFileUri ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferPropertiesIconFileUris()); set => this._iconFileUri = value; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris IconFileUri { get => (this._iconFileUri = this._iconFileUri ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferPropertiesIconFileUris()); set => this._iconFileUri = value; } /// Internal Acessors for CreatedAt - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal.CreatedAt { get => this._createdAt; set { {_createdAt = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal.CreatedAt { get => this._createdAt; set { {_createdAt = value;} } } /// Internal Acessors for ModifiedAt - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal.ModifiedAt { get => this._modifiedAt; set { {_modifiedAt = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal.ModifiedAt { get => this._modifiedAt; set { {_modifiedAt = value;} } } /// Internal Acessors for OfferDisplayName - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal.OfferDisplayName { get => this._offerDisplayName; set { {_offerDisplayName = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal.OfferDisplayName { get => this._offerDisplayName; set { {_offerDisplayName = value;} } } /// Internal Acessors for PrivateStoreId - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal.PrivateStoreId { get => this._privateStoreId; set { {_privateStoreId = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal.PrivateStoreId { get => this._privateStoreId; set { {_privateStoreId = value;} } } /// Internal Acessors for PublisherDisplayName - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal.PublisherDisplayName { get => this._publisherDisplayName; set { {_publisherDisplayName = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal.PublisherDisplayName { get => this._publisherDisplayName; set { {_publisherDisplayName = value;} } } /// Internal Acessors for UniqueOfferId - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesInternal.UniqueOfferId { get => this._uniqueOfferId; set { {_uniqueOfferId = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesInternal.UniqueOfferId { get => this._uniqueOfferId; set { {_uniqueOfferId = value;} } } /// Backing field for property. private string _modifiedAt; @@ -66,11 +66,11 @@ public partial class OfferProperties : public string OfferDisplayName { get => this._offerDisplayName; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan[] _plan; + private System.Collections.Generic.List _plan; /// Offer plans [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan[] Plan { get => this._plan; set => this._plan = value; } + public System.Collections.Generic.List Plan { get => this._plan; set => this._plan = value; } /// Backing field for property. private string _privateStoreId; @@ -87,11 +87,11 @@ public partial class OfferProperties : public string PublisherDisplayName { get => this._publisherDisplayName; } /// Backing field for property. - private string[] _specificPlanIdsLimitation; + private System.Collections.Generic.List _specificPlanIdsLimitation; /// Plan ids limitation for this offer [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public string[] SpecificPlanIdsLimitation { get => this._specificPlanIdsLimitation; set => this._specificPlanIdsLimitation = value; } + public System.Collections.Generic.List SpecificPlanIdsLimitation { get => this._specificPlanIdsLimitation; set => this._specificPlanIdsLimitation = value; } /// Backing field for property. private string _uniqueOfferId; @@ -123,6 +123,9 @@ public partial interface IOfferProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Private store offer creation date", SerializedName = @"createdAt", PossibleTypes = new [] { typeof(string) })] @@ -131,6 +134,9 @@ public partial interface IOfferProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Identifier for purposes of race condition", SerializedName = @"eTag", PossibleTypes = new [] { typeof(string) })] @@ -139,14 +145,20 @@ public partial interface IOfferProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Icon File Uris", SerializedName = @"iconFileUris", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris IconFileUri { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris) })] + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris IconFileUri { get; set; } /// Private store offer modification date [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Private store offer modification date", SerializedName = @"modifiedAt", PossibleTypes = new [] { typeof(string) })] @@ -155,6 +167,9 @@ public partial interface IOfferProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"It will be displayed prominently in the marketplace", SerializedName = @"offerDisplayName", PossibleTypes = new [] { typeof(string) })] @@ -163,14 +178,20 @@ public partial interface IOfferProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Offer plans", SerializedName = @"plans", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan[] Plan { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan) })] + System.Collections.Generic.List Plan { get; set; } /// Private store unique id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Private store unique id", SerializedName = @"privateStoreId", PossibleTypes = new [] { typeof(string) })] @@ -179,6 +200,9 @@ public partial interface IOfferProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Publisher name that will be displayed prominently in the marketplace", SerializedName = @"publisherDisplayName", PossibleTypes = new [] { typeof(string) })] @@ -187,14 +211,20 @@ public partial interface IOfferProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Plan ids limitation for this offer", SerializedName = @"specificPlanIdsLimitation", PossibleTypes = new [] { typeof(string) })] - string[] SpecificPlanIdsLimitation { get; set; } + System.Collections.Generic.List SpecificPlanIdsLimitation { get; set; } /// Offers unique id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Offers unique id", SerializedName = @"uniqueOfferId", PossibleTypes = new [] { typeof(string) })] @@ -206,6 +236,9 @@ public partial interface IOfferProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated.", SerializedName = @"updateSuppressedDueIdempotence", PossibleTypes = new [] { typeof(bool) })] @@ -220,19 +253,19 @@ internal partial interface IOfferPropertiesInternal /// Identifier for purposes of race condition string ETag { get; set; } /// Icon File Uris - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris IconFileUri { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris IconFileUri { get; set; } /// Private store offer modification date string ModifiedAt { get; set; } /// It will be displayed prominently in the marketplace string OfferDisplayName { get; set; } /// Offer plans - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan[] Plan { get; set; } + System.Collections.Generic.List Plan { get; set; } /// Private store unique id string PrivateStoreId { get; set; } /// Publisher name that will be displayed prominently in the marketplace string PublisherDisplayName { get; set; } /// Plan ids limitation for this offer - string[] SpecificPlanIdsLimitation { get; set; } + System.Collections.Generic.List SpecificPlanIdsLimitation { get; set; } /// Offers unique id string UniqueOfferId { get; set; } /// diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferProperties.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferProperties.json.cs similarity index 84% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferProperties.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferProperties.json.cs index f04f752123ad..2d60b6267f3f 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferProperties.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferProperties.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -19,7 +19,7 @@ public partial class OfferProperties partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -29,7 +29,8 @@ public partial class OfferProperties /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -41,7 +42,8 @@ public partial class OfferProperties /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -51,13 +53,13 @@ public partial class OfferProperties partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new OfferProperties(json) : null; } @@ -74,17 +76,17 @@ internal OfferProperties(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime. { return; } - {_uniqueOfferId = If( json?.PropertyT("uniqueOfferId"), out var __jsonUniqueOfferId) ? (string)__jsonUniqueOfferId : (string)UniqueOfferId;} - {_offerDisplayName = If( json?.PropertyT("offerDisplayName"), out var __jsonOfferDisplayName) ? (string)__jsonOfferDisplayName : (string)OfferDisplayName;} - {_publisherDisplayName = If( json?.PropertyT("publisherDisplayName"), out var __jsonPublisherDisplayName) ? (string)__jsonPublisherDisplayName : (string)PublisherDisplayName;} - {_eTag = If( json?.PropertyT("eTag"), out var __jsonETag) ? (string)__jsonETag : (string)ETag;} - {_privateStoreId = If( json?.PropertyT("privateStoreId"), out var __jsonPrivateStoreId) ? (string)__jsonPrivateStoreId : (string)PrivateStoreId;} - {_createdAt = If( json?.PropertyT("createdAt"), out var __jsonCreatedAt) ? (string)__jsonCreatedAt : (string)CreatedAt;} - {_modifiedAt = If( json?.PropertyT("modifiedAt"), out var __jsonModifiedAt) ? (string)__jsonModifiedAt : (string)ModifiedAt;} - {_specificPlanIdsLimitation = If( json?.PropertyT("specificPlanIdsLimitation"), out var __jsonSpecificPlanIdsLimitation) ? If( __jsonSpecificPlanIdsLimitation as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : SpecificPlanIdsLimitation;} - {_updateSuppressedDueIdempotence = If( json?.PropertyT("updateSuppressedDueIdempotence"), out var __jsonUpdateSuppressedDueIdempotence) ? (bool?)__jsonUpdateSuppressedDueIdempotence : UpdateSuppressedDueIdempotence;} - {_iconFileUri = If( json?.PropertyT("iconFileUris"), out var __jsonIconFileUris) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferPropertiesIconFileUris.FromJson(__jsonIconFileUris) : IconFileUri;} - {_plan = If( json?.PropertyT("plans"), out var __jsonPlans) ? If( __jsonPlans as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Plan.FromJson(__p) )) ))() : null : Plan;} + {_uniqueOfferId = If( json?.PropertyT("uniqueOfferId"), out var __jsonUniqueOfferId) ? (string)__jsonUniqueOfferId : (string)_uniqueOfferId;} + {_offerDisplayName = If( json?.PropertyT("offerDisplayName"), out var __jsonOfferDisplayName) ? (string)__jsonOfferDisplayName : (string)_offerDisplayName;} + {_publisherDisplayName = If( json?.PropertyT("publisherDisplayName"), out var __jsonPublisherDisplayName) ? (string)__jsonPublisherDisplayName : (string)_publisherDisplayName;} + {_eTag = If( json?.PropertyT("eTag"), out var __jsonETag) ? (string)__jsonETag : (string)_eTag;} + {_privateStoreId = If( json?.PropertyT("privateStoreId"), out var __jsonPrivateStoreId) ? (string)__jsonPrivateStoreId : (string)_privateStoreId;} + {_createdAt = If( json?.PropertyT("createdAt"), out var __jsonCreatedAt) ? (string)__jsonCreatedAt : (string)_createdAt;} + {_modifiedAt = If( json?.PropertyT("modifiedAt"), out var __jsonModifiedAt) ? (string)__jsonModifiedAt : (string)_modifiedAt;} + {_specificPlanIdsLimitation = If( json?.PropertyT("specificPlanIdsLimitation"), out var __jsonSpecificPlanIdsLimitation) ? If( __jsonSpecificPlanIdsLimitation as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _specificPlanIdsLimitation;} + {_updateSuppressedDueIdempotence = If( json?.PropertyT("updateSuppressedDueIdempotence"), out var __jsonUpdateSuppressedDueIdempotence) ? (bool?)__jsonUpdateSuppressedDueIdempotence : _updateSuppressedDueIdempotence;} + {_iconFileUri = If( json?.PropertyT("iconFileUris"), out var __jsonIconFileUris) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferPropertiesIconFileUris.FromJson(__jsonIconFileUris) : _iconFileUri;} + {_plan = If( json?.PropertyT("plans"), out var __jsonPlans) ? If( __jsonPlans as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Plan.FromJson(__p) )) ))() : null : _plan;} AfterFromJson(json); } @@ -107,28 +109,28 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._uniqueOfferId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._uniqueOfferId.ToString()) : null, "uniqueOfferId" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._offerDisplayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._offerDisplayName.ToString()) : null, "offerDisplayName" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._publisherDisplayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._publisherDisplayName.ToString()) : null, "publisherDisplayName" ,container.Add ); } AddIf( null != (((object)this._eTag)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._eTag.ToString()) : null, "eTag" ,container.Add ); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._privateStoreId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._privateStoreId.ToString()) : null, "privateStoreId" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._createdAt)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._createdAt.ToString()) : null, "createdAt" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._modifiedAt)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._modifiedAt.ToString()) : null, "modifiedAt" ,container.Add ); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferPropertiesIconFileUris.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferPropertiesIconFileUris.PowerShell.cs similarity index 77% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferPropertiesIconFileUris.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferPropertiesIconFileUris.PowerShell.cs index 0030068e357d..c773ed27c707 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferPropertiesIconFileUris.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferPropertiesIconFileUris.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class OfferPropertiesIconFileUris /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class OfferPropertiesIconFileUris /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,29 +55,35 @@ public partial class OfferPropertiesIconFileUris partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new OfferPropertiesIconFileUris(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new OfferPropertiesIconFileUris(content); } @@ -84,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -107,7 +115,7 @@ internal OfferPropertiesIconFileUris(global::System.Collections.IDictionary cont } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -129,6 +137,18 @@ internal OfferPropertiesIconFileUris(global::System.Management.Automation.PSObje /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Icon File Uris [System.ComponentModel.TypeConverter(typeof(OfferPropertiesIconFileUrisTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferPropertiesIconFileUris.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferPropertiesIconFileUris.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferPropertiesIconFileUris.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferPropertiesIconFileUris.TypeConverter.cs index 7426ec5267b7..c78ca92261a6 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferPropertiesIconFileUris.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferPropertiesIconFileUris.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class OfferPropertiesIconFileUrisTypeConverter : global::System.M { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferPropertiesIconFileUris.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferPropertiesIconFileUris.cs similarity index 78% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferPropertiesIconFileUris.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferPropertiesIconFileUris.cs index e21a5a6143c1..be2c2aa8387a 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferPropertiesIconFileUris.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferPropertiesIconFileUris.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Icon File Uris public partial class OfferPropertiesIconFileUris : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUrisInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUrisInternal { /// Creates an new instance. diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferPropertiesIconFileUris.dictionary.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferPropertiesIconFileUris.dictionary.cs similarity index 95% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferPropertiesIconFileUris.dictionary.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferPropertiesIconFileUris.dictionary.cs index be3ee1bdb2fe..4d0171ef1ad2 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferPropertiesIconFileUris.dictionary.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferPropertiesIconFileUris.dictionary.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -70,6 +70,6 @@ public void CopyFrom(global::System.Management.Automation.PSObject source) /// - public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferPropertiesIconFileUris source) => source.__additionalProperties; + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferPropertiesIconFileUris source) => source.__additionalProperties; } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferPropertiesIconFileUris.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferPropertiesIconFileUris.json.cs similarity index 89% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferPropertiesIconFileUris.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferPropertiesIconFileUris.json.cs index 8ddef9f04eb8..f73efcf701ac 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OfferPropertiesIconFileUris.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OfferPropertiesIconFileUris.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class OfferPropertiesIconFileUris partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class OfferPropertiesIconFileUris /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class OfferPropertiesIconFileUris /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class OfferPropertiesIconFileUris partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new OfferPropertiesIconFileUris(json) : null; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OperationListResult.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OperationListResult.PowerShell.cs similarity index 67% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OperationListResult.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/OperationListResult.PowerShell.cs index 13e51ea57f68..a6ae590817f9 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OperationListResult.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OperationListResult.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -34,7 +34,8 @@ public partial class OperationListResult /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -46,7 +47,8 @@ public partial class OperationListResult /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -56,27 +58,35 @@ public partial class OperationListResult partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new OperationListResult(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new OperationListResult(content); } @@ -85,11 +95,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -104,17 +114,17 @@ internal OperationListResult(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SingleOperationTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SingleOperationTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResultInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -129,11 +139,11 @@ internal OperationListResult(global::System.Management.Automation.PSObject conte // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SingleOperationTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResultInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SingleOperationTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResultInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -142,6 +152,18 @@ internal OperationListResult(global::System.Management.Automation.PSObject conte /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Result of the request to list Marketplace operations. It contains a list of operations and a URL link to get the next /// set of results. diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OperationListResult.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OperationListResult.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OperationListResult.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/OperationListResult.TypeConverter.cs index d940f5eb151b..f000021e700c 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OperationListResult.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OperationListResult.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class OperationListResultTypeConverter : global::System.Managemen { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResult ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResult ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResult).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResult).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OperationListResult.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OperationListResult.cs similarity index 75% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OperationListResult.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/OperationListResult.cs index 8928b72643a0..26e31d368c31 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OperationListResult.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OperationListResult.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -12,12 +12,12 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 /// set of results. /// public partial class OperationListResult : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResult, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResultInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResult, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResultInternal { /// Internal Acessors for NextLink - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResultInternal.NextLink { get => this._nextLink; set { {_nextLink = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResultInternal.NextLink { get => this._nextLink; set { {_nextLink = value;} } } /// Backing field for property. private string _nextLink; @@ -27,13 +27,13 @@ public partial class OperationListResult : public string NextLink { get => this._nextLink; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperation[] _value; + private System.Collections.Generic.List _value; /// /// List of Microsoft.Marketplace operations supported by the Microsoft.Marketplace resource provider. /// [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperation[] Value { get => this._value; set => this._value = value; } + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } /// Creates an new instance. public OperationListResult() @@ -50,6 +50,9 @@ public partial interface IOperationListResult : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"URL to get the next set of operation list results if there are any.", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -60,10 +63,13 @@ public partial interface IOperationListResult : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"List of Microsoft.Marketplace operations supported by the Microsoft.Marketplace resource provider.", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperation) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperation[] Value { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperation) })] + System.Collections.Generic.List Value { get; set; } } /// Result of the request to list Marketplace operations. It contains a list of operations and a URL link to get the next @@ -76,7 +82,7 @@ internal partial interface IOperationListResultInternal /// /// List of Microsoft.Marketplace operations supported by the Microsoft.Marketplace resource provider. /// - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperation[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OperationListResult.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OperationListResult.json.cs similarity index 85% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OperationListResult.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/OperationListResult.json.cs index 48be0a54413b..9440615fdde1 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/OperationListResult.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/OperationListResult.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -23,7 +23,7 @@ public partial class OperationListResult partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -33,7 +33,8 @@ public partial class OperationListResult /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -45,7 +46,8 @@ public partial class OperationListResult /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -55,13 +57,13 @@ public partial class OperationListResult partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResult. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResult. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResult. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResult. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new OperationListResult(json) : null; } @@ -78,8 +80,8 @@ internal OperationListResult(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runt { return; } - {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperation) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SingleOperation.FromJson(__u) )) ))() : null : Value;} - {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperation) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SingleOperation.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} AfterFromJson(json); } @@ -111,7 +113,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs } container.Add("value",__w); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Plan.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Plan.PowerShell.cs similarity index 65% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Plan.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/Plan.PowerShell.cs index 88927d569c5a..27a726101838 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Plan.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Plan.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -30,7 +30,8 @@ public partial class Plan /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -42,7 +43,8 @@ public partial class Plan /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -52,27 +54,35 @@ public partial class Plan partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new Plan(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new Plan(content); } @@ -81,11 +91,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -100,33 +110,33 @@ internal Plan(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("SkuId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).SkuId = (string) content.GetValueForProperty("SkuId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).SkuId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).SkuId = (string) content.GetValueForProperty("SkuId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).SkuId, global::System.Convert.ToString); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("DisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).DisplayName, global::System.Convert.ToString); } if (content.Contains("Accessibility")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).Accessibility = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Accessibility?) content.GetValueForProperty("Accessibility",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).Accessibility, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Accessibility.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).Accessibility = (string) content.GetValueForProperty("Accessibility",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).Accessibility, global::System.Convert.ToString); } if (content.Contains("AltStackReference")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).AltStackReference = (string) content.GetValueForProperty("AltStackReference",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).AltStackReference, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).AltStackReference = (string) content.GetValueForProperty("AltStackReference",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).AltStackReference, global::System.Convert.ToString); } if (content.Contains("StackType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).StackType = (string) content.GetValueForProperty("StackType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).StackType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).StackType = (string) content.GetValueForProperty("StackType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).StackType, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -141,27 +151,27 @@ internal Plan(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("SkuId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).SkuId = (string) content.GetValueForProperty("SkuId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).SkuId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).SkuId = (string) content.GetValueForProperty("SkuId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).SkuId, global::System.Convert.ToString); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("DisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).DisplayName, global::System.Convert.ToString); } if (content.Contains("Accessibility")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).Accessibility = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Accessibility?) content.GetValueForProperty("Accessibility",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).Accessibility, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Accessibility.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).Accessibility = (string) content.GetValueForProperty("Accessibility",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).Accessibility, global::System.Convert.ToString); } if (content.Contains("AltStackReference")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).AltStackReference = (string) content.GetValueForProperty("AltStackReference",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).AltStackReference, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).AltStackReference = (string) content.GetValueForProperty("AltStackReference",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).AltStackReference, global::System.Convert.ToString); } if (content.Contains("StackType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).StackType = (string) content.GetValueForProperty("StackType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal)this).StackType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).StackType = (string) content.GetValueForProperty("StackType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal)this).StackType, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -170,6 +180,18 @@ internal Plan(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } [System.ComponentModel.TypeConverter(typeof(PlanTypeConverter))] public partial interface IPlan diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Plan.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Plan.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Plan.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/Plan.TypeConverter.cs index 1860e325609a..0cd4e160eb1e 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Plan.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Plan.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,19 @@ public partial class PlanTypeConverter : global::System.Management.Automation.PS { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +74,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +99,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Plan.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Plan.cs similarity index 78% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Plan.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/Plan.cs index c6105dc79605..dbf0749b5c2f 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Plan.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Plan.cs @@ -3,21 +3,21 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; public partial class Plan : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Accessibility? _accessibility; + private string _accessibility; /// Plan accessibility [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Accessibility? Accessibility { get => this._accessibility; set => this._accessibility = value; } + public string Accessibility { get => this._accessibility; set => this._accessibility = value; } /// Backing field for property. private string _altStackReference; @@ -41,19 +41,19 @@ public partial class Plan : public string Id { get => this._id; } /// Internal Acessors for AltStackReference - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal.AltStackReference { get => this._altStackReference; set { {_altStackReference = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal.AltStackReference { get => this._altStackReference; set { {_altStackReference = value;} } } /// Internal Acessors for DisplayName - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal.DisplayName { get => this._displayName; set { {_displayName = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal.DisplayName { get => this._displayName; set { {_displayName = value;} } } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal.Id { get => this._id; set { {_id = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal.Id { get => this._id; set { {_id = value;} } } /// Internal Acessors for SkuId - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal.SkuId { get => this._skuId; set { {_skuId = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal.SkuId { get => this._skuId; set { {_skuId = value;} } } /// Internal Acessors for StackType - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanInternal.StackType { get => this._stackType; set { {_stackType = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanInternal.StackType { get => this._stackType; set { {_stackType = value;} } } /// Backing field for property. private string _skuId; @@ -82,14 +82,21 @@ public partial interface IPlan : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Plan accessibility", SerializedName = @"accessibility", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Accessibility) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Accessibility? Accessibility { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("Unknown", "Public", "PrivateTenantOnLevel", "PrivateSubscriptionOnLevel")] + string Accessibility { get; set; } /// Alternative stack type [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Alternative stack type", SerializedName = @"altStackReference", PossibleTypes = new [] { typeof(string) })] @@ -98,6 +105,9 @@ public partial interface IPlan : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Friendly name for the plan for display in the marketplace", SerializedName = @"planDisplayName", PossibleTypes = new [] { typeof(string) })] @@ -106,6 +116,9 @@ public partial interface IPlan : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Text identifier for this plan", SerializedName = @"planId", PossibleTypes = new [] { typeof(string) })] @@ -114,6 +127,9 @@ public partial interface IPlan : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Identifier for this plan", SerializedName = @"skuId", PossibleTypes = new [] { typeof(string) })] @@ -122,6 +138,9 @@ public partial interface IPlan : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Stack type (classic or arm)", SerializedName = @"stackType", PossibleTypes = new [] { typeof(string) })] @@ -132,7 +151,8 @@ internal partial interface IPlanInternal { /// Plan accessibility - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Accessibility? Accessibility { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("Unknown", "Public", "PrivateTenantOnLevel", "PrivateSubscriptionOnLevel")] + string Accessibility { get; set; } /// Alternative stack type string AltStackReference { get; set; } /// Friendly name for the plan for display in the marketplace diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Plan.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Plan.json.cs similarity index 86% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Plan.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/Plan.json.cs index ca32b435c679..97b773b73cdc 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Plan.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Plan.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -19,7 +19,7 @@ public partial class Plan partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -29,7 +29,8 @@ public partial class Plan /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -41,7 +42,8 @@ public partial class Plan /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -51,13 +53,11 @@ public partial class Plan partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new Plan(json) : null; } @@ -74,12 +74,12 @@ internal Plan(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonOb { return; } - {_skuId = If( json?.PropertyT("skuId"), out var __jsonSkuId) ? (string)__jsonSkuId : (string)SkuId;} - {_id = If( json?.PropertyT("planId"), out var __jsonPlanId) ? (string)__jsonPlanId : (string)Id;} - {_displayName = If( json?.PropertyT("planDisplayName"), out var __jsonPlanDisplayName) ? (string)__jsonPlanDisplayName : (string)DisplayName;} - {_accessibility = If( json?.PropertyT("accessibility"), out var __jsonAccessibility) ? (string)__jsonAccessibility : (string)Accessibility;} - {_altStackReference = If( json?.PropertyT("altStackReference"), out var __jsonAltStackReference) ? (string)__jsonAltStackReference : (string)AltStackReference;} - {_stackType = If( json?.PropertyT("stackType"), out var __jsonStackType) ? (string)__jsonStackType : (string)StackType;} + {_skuId = If( json?.PropertyT("skuId"), out var __jsonSkuId) ? (string)__jsonSkuId : (string)_skuId;} + {_id = If( json?.PropertyT("planId"), out var __jsonPlanId) ? (string)__jsonPlanId : (string)_id;} + {_displayName = If( json?.PropertyT("planDisplayName"), out var __jsonPlanDisplayName) ? (string)__jsonPlanDisplayName : (string)_displayName;} + {_accessibility = If( json?.PropertyT("accessibility"), out var __jsonAccessibility) ? (string)__jsonAccessibility : (string)_accessibility;} + {_altStackReference = If( json?.PropertyT("altStackReference"), out var __jsonAltStackReference) ? (string)__jsonAltStackReference : (string)_altStackReference;} + {_stackType = If( json?.PropertyT("stackType"), out var __jsonStackType) ? (string)__jsonStackType : (string)_stackType;} AfterFromJson(json); } @@ -102,24 +102,24 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._skuId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._skuId.ToString()) : null, "skuId" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._id.ToString()) : null, "planId" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._displayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._displayName.ToString()) : null, "planDisplayName" ,container.Add ); } AddIf( null != (((object)this._accessibility)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._accessibility.ToString()) : null, "accessibility" ,container.Add ); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._altStackReference)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._altStackReference.ToString()) : null, "altStackReference" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._stackType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._stackType.ToString()) : null, "stackType" ,container.Add ); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanDetails.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanDetails.PowerShell.cs similarity index 62% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanDetails.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanDetails.PowerShell.cs index b3b88c9381d0..49c74070e637 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanDetails.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanDetails.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class PlanDetails /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class PlanDetails /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,27 +55,35 @@ public partial class PlanDetails partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new PlanDetails(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new PlanDetails(content); } @@ -82,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -101,33 +111,33 @@ internal PlanDetails(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).PlanId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).PlanId, global::System.Convert.ToString); } if (content.Contains("Status")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).Status, global::System.Convert.ToString); } if (content.Contains("RequestDate")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).RequestDate = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAny) content.GetValueForProperty("RequestDate",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).RequestDate, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AnyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).RequestDate = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAny) content.GetValueForProperty("RequestDate",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).RequestDate, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AnyTypeConverter.ConvertFrom); } if (content.Contains("Justification")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).Justification = (string) content.GetValueForProperty("Justification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).Justification, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).Justification = (string) content.GetValueForProperty("Justification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).Justification, global::System.Convert.ToString); } if (content.Contains("SubscriptionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).SubscriptionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).SubscriptionId, global::System.Convert.ToString); } if (content.Contains("SubscriptionName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).SubscriptionName = (string) content.GetValueForProperty("SubscriptionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).SubscriptionName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).SubscriptionName = (string) content.GetValueForProperty("SubscriptionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).SubscriptionName, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -142,27 +152,27 @@ internal PlanDetails(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).PlanId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).PlanId, global::System.Convert.ToString); } if (content.Contains("Status")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).Status = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status?) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).Status, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).Status, global::System.Convert.ToString); } if (content.Contains("RequestDate")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).RequestDate = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAny) content.GetValueForProperty("RequestDate",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).RequestDate, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AnyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).RequestDate = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAny) content.GetValueForProperty("RequestDate",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).RequestDate, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AnyTypeConverter.ConvertFrom); } if (content.Contains("Justification")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).Justification = (string) content.GetValueForProperty("Justification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).Justification, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).Justification = (string) content.GetValueForProperty("Justification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).Justification, global::System.Convert.ToString); } if (content.Contains("SubscriptionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).SubscriptionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).SubscriptionId, global::System.Convert.ToString); } if (content.Contains("SubscriptionName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).SubscriptionName = (string) content.GetValueForProperty("SubscriptionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal)this).SubscriptionName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).SubscriptionName = (string) content.GetValueForProperty("SubscriptionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal)this).SubscriptionName, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -171,6 +181,18 @@ internal PlanDetails(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Return plan with request details [System.ComponentModel.TypeConverter(typeof(PlanDetailsTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanDetails.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanDetails.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanDetails.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanDetails.TypeConverter.cs index f8672b19e053..2332aaa2dd60 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanDetails.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanDetails.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class PlanDetailsTypeConverter : global::System.Management.Automa { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetails ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetails).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanDetails.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanDetails.cs similarity index 82% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanDetails.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanDetails.cs index e84430ed93a4..cadd891b3387 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanDetails.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanDetails.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Return plan with request details public partial class PlanDetails : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetails, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal { /// Backing field for property. @@ -21,10 +21,10 @@ public partial class PlanDetails : public string Justification { get => this._justification; set => this._justification = value; } /// Internal Acessors for RequestDate - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAny Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal.RequestDate { get => (this._requestDate = this._requestDate ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Any()); set { {_requestDate = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAny Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal.RequestDate { get => (this._requestDate = this._requestDate ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Any()); set { {_requestDate = value;} } } /// Internal Acessors for Status - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetailsInternal.Status { get => this._status; set { {_status = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetailsInternal.Status { get => this._status; set { {_status = value;} } } /// Backing field for property. private string _planId; @@ -41,11 +41,11 @@ public partial class PlanDetails : public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAny RequestDate { get => (this._requestDate = this._requestDate ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Any()); } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status? _status; + private string _status; /// Gets the plan status [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status? Status { get => this._status; } + public string Status { get => this._status; } /// Backing field for property. private string _subscriptionId; @@ -77,6 +77,9 @@ public partial interface IPlanDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets user's justification for the plan's request", SerializedName = @"justification", PossibleTypes = new [] { typeof(string) })] @@ -85,6 +88,9 @@ public partial interface IPlanDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets Plan Id ", SerializedName = @"planId", PossibleTypes = new [] { typeof(string) })] @@ -93,6 +99,9 @@ public partial interface IPlanDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets request date", SerializedName = @"requestDate", PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAny) })] @@ -101,14 +110,21 @@ public partial interface IPlanDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets the plan status", SerializedName = @"status", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status? Status { get; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("Pending", "Rejected", "Approved", "None")] + string Status { get; } /// Gets or sets the subscription id that the user is requesting to add the plan to [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the subscription id that the user is requesting to add the plan to", SerializedName = @"subscriptionId", PossibleTypes = new [] { typeof(string) })] @@ -119,6 +135,9 @@ public partial interface IPlanDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the subscription name that the user is requesting to add the plan to", SerializedName = @"subscriptionName", PossibleTypes = new [] { typeof(string) })] @@ -136,7 +155,8 @@ internal partial interface IPlanDetailsInternal /// Gets request date Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAny RequestDate { get; set; } /// Gets the plan status - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status? Status { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("Pending", "Rejected", "Approved", "None")] + string Status { get; set; } /// Gets or sets the subscription id that the user is requesting to add the plan to string SubscriptionId { get; set; } /// diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanDetails.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanDetails.json.cs similarity index 88% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanDetails.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanDetails.json.cs index 6e88061f9210..fb778637c0ce 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanDetails.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanDetails.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class PlanDetails partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class PlanDetails /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class PlanDetails /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class PlanDetails partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetails. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetails. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new PlanDetails(json) : null; } @@ -75,12 +77,12 @@ internal PlanDetails(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json { return; } - {_planId = If( json?.PropertyT("planId"), out var __jsonPlanId) ? (string)__jsonPlanId : (string)PlanId;} - {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)Status;} - {_requestDate = If( json?.PropertyT("requestDate"), out var __jsonRequestDate) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Any.FromJson(__jsonRequestDate) : RequestDate;} - {_justification = If( json?.PropertyT("justification"), out var __jsonJustification) ? (string)__jsonJustification : (string)Justification;} - {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} - {_subscriptionName = If( json?.PropertyT("subscriptionName"), out var __jsonSubscriptionName) ? (string)__jsonSubscriptionName : (string)SubscriptionName;} + {_planId = If( json?.PropertyT("planId"), out var __jsonPlanId) ? (string)__jsonPlanId : (string)_planId;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)_status;} + {_requestDate = If( json?.PropertyT("requestDate"), out var __jsonRequestDate) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Any.FromJson(__jsonRequestDate) : _requestDate;} + {_justification = If( json?.PropertyT("justification"), out var __jsonJustification) ? (string)__jsonJustification : (string)_justification;} + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)_subscriptionId;} + {_subscriptionName = If( json?.PropertyT("subscriptionName"), out var __jsonSubscriptionName) ? (string)__jsonSubscriptionName : (string)_subscriptionName;} AfterFromJson(json); } @@ -104,11 +106,11 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs return container; } AddIf( null != (((object)this._planId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._planId.ToString()) : null, "planId" ,container.Add ); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != this._requestDate ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) this._requestDate.ToJson(null,serializationMode) : null, "requestDate" ,container.Add ); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanNotificationDetails.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanNotificationDetails.PowerShell.cs similarity index 70% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanNotificationDetails.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanNotificationDetails.PowerShell.cs index 8abae759dd44..dd68b2e9e25d 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanNotificationDetails.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanNotificationDetails.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class PlanNotificationDetails /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class PlanNotificationDetails /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,29 +55,35 @@ public partial class PlanNotificationDetails partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new PlanNotificationDetails(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new PlanNotificationDetails(content); } @@ -84,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,17 +111,17 @@ internal PlanNotificationDetails(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetailsInternal)this).PlanId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetailsInternal)this).PlanId, global::System.Convert.ToString); } if (content.Contains("PlanDisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetailsInternal)this).PlanDisplayName = (string) content.GetValueForProperty("PlanDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetailsInternal)this).PlanDisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetailsInternal)this).PlanDisplayName = (string) content.GetValueForProperty("PlanDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetailsInternal)this).PlanDisplayName, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -128,11 +136,11 @@ internal PlanNotificationDetails(global::System.Management.Automation.PSObject c // actually deserialize if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetailsInternal)this).PlanId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetailsInternal)this).PlanId, global::System.Convert.ToString); } if (content.Contains("PlanDisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetailsInternal)this).PlanDisplayName = (string) content.GetValueForProperty("PlanDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetailsInternal)this).PlanDisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetailsInternal)this).PlanDisplayName = (string) content.GetValueForProperty("PlanDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetailsInternal)this).PlanDisplayName, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -141,6 +149,18 @@ internal PlanNotificationDetails(global::System.Management.Automation.PSObject c /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Plan notification details [System.ComponentModel.TypeConverter(typeof(PlanNotificationDetailsTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanNotificationDetails.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanNotificationDetails.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanNotificationDetails.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanNotificationDetails.TypeConverter.cs index 97dde3bf03fa..3dfa48b2ace7 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanNotificationDetails.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanNotificationDetails.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class PlanNotificationDetailsTypeConverter : global::System.Manag { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetails ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetails).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanNotificationDetails.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanNotificationDetails.cs similarity index 87% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanNotificationDetails.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanNotificationDetails.cs index 454e4cacb858..a1be529232c7 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanNotificationDetails.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanNotificationDetails.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Plan notification details public partial class PlanNotificationDetails : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetailsInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetails, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetailsInternal { /// Backing field for property. @@ -41,6 +41,9 @@ public partial interface IPlanNotificationDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the plan display name", SerializedName = @"planDisplayName", PossibleTypes = new [] { typeof(string) })] @@ -49,6 +52,9 @@ public partial interface IPlanNotificationDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the plan id", SerializedName = @"planId", PossibleTypes = new [] { typeof(string) })] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanNotificationDetails.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanNotificationDetails.json.cs similarity index 89% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanNotificationDetails.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanNotificationDetails.json.cs index dc7f6264bac9..a0a9bb9450f5 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanNotificationDetails.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanNotificationDetails.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class PlanNotificationDetails partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class PlanNotificationDetails /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class PlanNotificationDetails /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class PlanNotificationDetails partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetails. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetails. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new PlanNotificationDetails(json) : null; } @@ -75,8 +77,8 @@ internal PlanNotificationDetails(Microsoft.Azure.PowerShell.Cmdlets.Marketplace. { return; } - {_planId = If( json?.PropertyT("planId"), out var __jsonPlanId) ? (string)__jsonPlanId : (string)PlanId;} - {_planDisplayName = If( json?.PropertyT("planDisplayName"), out var __jsonPlanDisplayName) ? (string)__jsonPlanDisplayName : (string)PlanDisplayName;} + {_planId = If( json?.PropertyT("planId"), out var __jsonPlanId) ? (string)__jsonPlanId : (string)_planId;} + {_planDisplayName = If( json?.PropertyT("planDisplayName"), out var __jsonPlanDisplayName) ? (string)__jsonPlanDisplayName : (string)_planDisplayName;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanRequesterDetails.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanRequesterDetails.PowerShell.cs similarity index 64% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanRequesterDetails.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanRequesterDetails.PowerShell.cs index 388127161402..34b3e9aa1d36 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanRequesterDetails.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanRequesterDetails.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class PlanRequesterDetails /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class PlanRequesterDetails /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,27 +55,35 @@ public partial class PlanRequesterDetails partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new PlanRequesterDetails(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new PlanRequesterDetails(content); } @@ -82,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -101,21 +111,21 @@ internal PlanRequesterDetails(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetailsInternal)this).PlanId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetailsInternal)this).PlanId, global::System.Convert.ToString); } if (content.Contains("PlanDisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetailsInternal)this).PlanDisplayName = (string) content.GetValueForProperty("PlanDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetailsInternal)this).PlanDisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetailsInternal)this).PlanDisplayName = (string) content.GetValueForProperty("PlanDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetailsInternal)this).PlanDisplayName, global::System.Convert.ToString); } if (content.Contains("Requester")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetailsInternal)this).Requester = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetails[]) content.GetValueForProperty("Requester",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetailsInternal)this).Requester, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.UserRequestDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetailsInternal)this).Requester = (System.Collections.Generic.List) content.GetValueForProperty("Requester",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetailsInternal)this).Requester, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.UserRequestDetailsTypeConverter.ConvertFrom)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -130,15 +140,15 @@ internal PlanRequesterDetails(global::System.Management.Automation.PSObject cont // actually deserialize if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetailsInternal)this).PlanId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetailsInternal)this).PlanId, global::System.Convert.ToString); } if (content.Contains("PlanDisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetailsInternal)this).PlanDisplayName = (string) content.GetValueForProperty("PlanDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetailsInternal)this).PlanDisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetailsInternal)this).PlanDisplayName = (string) content.GetValueForProperty("PlanDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetailsInternal)this).PlanDisplayName, global::System.Convert.ToString); } if (content.Contains("Requester")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetailsInternal)this).Requester = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetails[]) content.GetValueForProperty("Requester",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetailsInternal)this).Requester, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.UserRequestDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetailsInternal)this).Requester = (System.Collections.Generic.List) content.GetValueForProperty("Requester",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetailsInternal)this).Requester, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.UserRequestDetailsTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } @@ -147,6 +157,18 @@ internal PlanRequesterDetails(global::System.Management.Automation.PSObject cont /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Plan with requesters details [System.ComponentModel.TypeConverter(typeof(PlanRequesterDetailsTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanRequesterDetails.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanRequesterDetails.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanRequesterDetails.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanRequesterDetails.TypeConverter.cs index b5dc0256d9d3..a78cb2280ab5 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanRequesterDetails.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanRequesterDetails.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class PlanRequesterDetailsTypeConverter : global::System.Manageme { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetails ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetails).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanRequesterDetails.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanRequesterDetails.cs similarity index 69% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanRequesterDetails.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanRequesterDetails.cs index d351f205bae6..d076fde930d8 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanRequesterDetails.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanRequesterDetails.cs @@ -3,24 +3,24 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Plan with requesters details public partial class PlanRequesterDetails : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetailsInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetails, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetailsInternal { /// Internal Acessors for PlanDisplayName - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetailsInternal.PlanDisplayName { get => this._planDisplayName; set { {_planDisplayName = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetailsInternal.PlanDisplayName { get => this._planDisplayName; set { {_planDisplayName = value;} } } /// Internal Acessors for PlanId - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetailsInternal.PlanId { get => this._planId; set { {_planId = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetailsInternal.PlanId { get => this._planId; set { {_planId = value;} } } /// Internal Acessors for Requester - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetails[] Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetailsInternal.Requester { get => this._requester; set { {_requester = value;} } } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetailsInternal.Requester { get => this._requester; set { {_requester = value;} } } /// Backing field for property. private string _planDisplayName; @@ -37,11 +37,11 @@ public partial class PlanRequesterDetails : public string PlanId { get => this._planId; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetails[] _requester; + private System.Collections.Generic.List _requester; /// Gets requesters details list [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetails[] Requester { get => this._requester; } + public System.Collections.Generic.List Requester { get => this._requester; } /// Creates an new instance. public PlanRequesterDetails() @@ -57,6 +57,9 @@ public partial interface IPlanRequesterDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets the plan display name", SerializedName = @"planDisplayName", PossibleTypes = new [] { typeof(string) })] @@ -65,6 +68,9 @@ public partial interface IPlanRequesterDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets the plan id", SerializedName = @"planId", PossibleTypes = new [] { typeof(string) })] @@ -73,10 +79,13 @@ public partial interface IPlanRequesterDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets requesters details list", SerializedName = @"requesters", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetails) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetails[] Requester { get; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetails) })] + System.Collections.Generic.List Requester { get; } } /// Plan with requesters details @@ -88,7 +97,7 @@ internal partial interface IPlanRequesterDetailsInternal /// Gets the plan id string PlanId { get; set; } /// Gets requesters details list - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetails[] Requester { get; set; } + System.Collections.Generic.List Requester { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanRequesterDetails.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanRequesterDetails.json.cs similarity index 84% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanRequesterDetails.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanRequesterDetails.json.cs index 641bb15837b9..45fbd0ea1caf 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PlanRequesterDetails.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PlanRequesterDetails.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class PlanRequesterDetails partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class PlanRequesterDetails /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class PlanRequesterDetails /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class PlanRequesterDetails partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetails. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetails. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanRequesterDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanRequesterDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new PlanRequesterDetails(json) : null; } @@ -75,9 +77,9 @@ internal PlanRequesterDetails(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Run { return; } - {_planId = If( json?.PropertyT("planId"), out var __jsonPlanId) ? (string)__jsonPlanId : (string)PlanId;} - {_planDisplayName = If( json?.PropertyT("planDisplayName"), out var __jsonPlanDisplayName) ? (string)__jsonPlanDisplayName : (string)PlanDisplayName;} - {_requester = If( json?.PropertyT("requesters"), out var __jsonRequesters) ? If( __jsonRequesters as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.UserRequestDetails.FromJson(__u) )) ))() : null : Requester;} + {_planId = If( json?.PropertyT("planId"), out var __jsonPlanId) ? (string)__jsonPlanId : (string)_planId;} + {_planDisplayName = If( json?.PropertyT("planDisplayName"), out var __jsonPlanDisplayName) ? (string)__jsonPlanDisplayName : (string)_planDisplayName;} + {_requester = If( json?.PropertyT("requesters"), out var __jsonRequesters) ? If( __jsonRequesters as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.UserRequestDetails.FromJson(__u) )) ))() : null : _requester;} AfterFromJson(json); } @@ -100,15 +102,15 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._planId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._planId.ToString()) : null, "planId" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._planDisplayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._planDisplayName.ToString()) : null, "planDisplayName" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { if (null != this._requester) { diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStore.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStore.PowerShell.cs new file mode 100644 index 000000000000..456105f30eec --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStore.PowerShell.cs @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// The PrivateStore data structure. + [System.ComponentModel.TypeConverter(typeof(PrivateStoreTypeConverter))] + public partial class PrivateStore + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PrivateStore(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PrivateStore(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PrivateStore(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStorePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Availability")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).Availability = (string) content.GetValueForProperty("Availability",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).Availability, global::System.Convert.ToString); + } + if (content.Contains("NotificationsSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).NotificationsSetting = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsProperties) content.GetValueForProperty("NotificationsSetting",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).NotificationsSetting, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.NotificationsSettingsPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("PrivateStoreId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).PrivateStoreId = (string) content.GetValueForProperty("PrivateStoreId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).PrivateStoreId, global::System.Convert.ToString); + } + if (content.Contains("ETag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).ETag, global::System.Convert.ToString); + } + if (content.Contains("PrivateStoreName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).PrivateStoreName = (string) content.GetValueForProperty("PrivateStoreName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).PrivateStoreName, global::System.Convert.ToString); + } + if (content.Contains("TenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).TenantId = (string) content.GetValueForProperty("TenantId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).TenantId, global::System.Convert.ToString); + } + if (content.Contains("IsGov")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).IsGov = (bool?) content.GetValueForProperty("IsGov",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).IsGov, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CollectionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).CollectionId = (System.Collections.Generic.List) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("Branding")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).Branding = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding) content.GetValueForProperty("Branding",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).Branding, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStorePropertiesBrandingTypeConverter.ConvertFrom); + } + if (content.Contains("NotificationSettingRecipient")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).NotificationSettingRecipient = (System.Collections.Generic.List) content.GetValueForProperty("NotificationSettingRecipient",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).NotificationSettingRecipient, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RecipientTypeConverter.ConvertFrom)); + } + if (content.Contains("NotificationSettingSendToAllMarketplaceAdmin")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).NotificationSettingSendToAllMarketplaceAdmin = (bool?) content.GetValueForProperty("NotificationSettingSendToAllMarketplaceAdmin",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).NotificationSettingSendToAllMarketplaceAdmin, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PrivateStore(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStorePropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Availability")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).Availability = (string) content.GetValueForProperty("Availability",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).Availability, global::System.Convert.ToString); + } + if (content.Contains("NotificationsSetting")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).NotificationsSetting = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsProperties) content.GetValueForProperty("NotificationsSetting",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).NotificationsSetting, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.NotificationsSettingsPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("PrivateStoreId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).PrivateStoreId = (string) content.GetValueForProperty("PrivateStoreId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).PrivateStoreId, global::System.Convert.ToString); + } + if (content.Contains("ETag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).ETag, global::System.Convert.ToString); + } + if (content.Contains("PrivateStoreName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).PrivateStoreName = (string) content.GetValueForProperty("PrivateStoreName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).PrivateStoreName, global::System.Convert.ToString); + } + if (content.Contains("TenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).TenantId = (string) content.GetValueForProperty("TenantId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).TenantId, global::System.Convert.ToString); + } + if (content.Contains("IsGov")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).IsGov = (bool?) content.GetValueForProperty("IsGov",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).IsGov, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CollectionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).CollectionId = (System.Collections.Generic.List) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("Branding")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).Branding = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding) content.GetValueForProperty("Branding",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).Branding, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStorePropertiesBrandingTypeConverter.ConvertFrom); + } + if (content.Contains("NotificationSettingRecipient")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).NotificationSettingRecipient = (System.Collections.Generic.List) content.GetValueForProperty("NotificationSettingRecipient",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).NotificationSettingRecipient, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RecipientTypeConverter.ConvertFrom)); + } + if (content.Contains("NotificationSettingSendToAllMarketplaceAdmin")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).NotificationSettingSendToAllMarketplaceAdmin = (bool?) content.GetValueForProperty("NotificationSettingSendToAllMarketplaceAdmin",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal)this).NotificationSettingSendToAllMarketplaceAdmin, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// The PrivateStore data structure. + [System.ComponentModel.TypeConverter(typeof(PrivateStoreTypeConverter))] + public partial interface IPrivateStore + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStore.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStore.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStore.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStore.TypeConverter.cs index 0ca78227d578..d8412cd4ac5f 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStore.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStore.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class PrivateStoreTypeConverter : global::System.Management.Autom { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStore.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStore.cs similarity index 54% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStore.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStore.cs index 7ae0702bf3b4..28b3ba225f43 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStore.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStore.cs @@ -3,132 +3,135 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// The PrivateStore data structure. public partial class PrivateStore : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IValidates { /// - /// Backing field for Inherited model + /// Backing field for Inherited model /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Resource(); + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Resource(); /// Indicates private store availability [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability? Availability { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).Availability; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).Availability = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability)""); } + public string Availability { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).Availability; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).Availability = value ?? null; } /// Gets or sets list of branding characteristics [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding Branding { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).Branding; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).Branding = value ?? null /* model class */; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding Branding { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).Branding; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).Branding = value ?? null /* model class */; } /// Gets list of associated collection ids [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string[] CollectionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).CollectionId; } + public System.Collections.Generic.List CollectionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).CollectionId; } /// Identifier for purposes of race condition [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string ETag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).ETag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).ETag = value ?? null; } + public string ETag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).ETag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).ETag = value ?? null; } /// The resource ID. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Id; } + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Id; } /// Is government [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public bool? IsGov { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).IsGov; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).IsGov = value ?? default(bool); } + public bool? IsGov { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).IsGov; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).IsGov = value ?? default(bool); } /// Internal Acessors for CollectionId - string[] Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal.CollectionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).CollectionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).CollectionId = value; } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal.CollectionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).CollectionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).CollectionId = value; } /// Internal Acessors for NotificationsSetting - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsProperties Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal.NotificationsSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).NotificationsSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).NotificationsSetting = value; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsProperties Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal.NotificationsSetting { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).NotificationsSetting; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).NotificationsSetting = value; } /// Internal Acessors for PrivateStoreId - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal.PrivateStoreId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).PrivateStoreId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).PrivateStoreId = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal.PrivateStoreId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).PrivateStoreId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).PrivateStoreId = value; } /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreProperties Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStoreProperties()); set { {_property = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreProperties Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStoreProperties()); set { {_property = value;} } } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Id = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Id = value; } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Name = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Name = value; } /// Internal Acessors for SystemData - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemData = value; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemData = value; } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Type = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Type = value; } /// The name of the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Name; } + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Name; } /// Gets or sets list of notified recipients for new requests [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[] NotificationSettingRecipient { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).NotificationSettingRecipient; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).NotificationSettingRecipient = value ?? null /* arrayOf */; } + public System.Collections.Generic.List NotificationSettingRecipient { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).NotificationSettingRecipient; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).NotificationSettingRecipient = value ?? null /* arrayOf */; } /// Gets or sets whether to send email to all marketplace admins for new requests [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public bool? NotificationSettingSendToAllMarketplaceAdmin { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).NotificationSettingSendToAllMarketplaceAdmin; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).NotificationSettingSendToAllMarketplaceAdmin = value ?? default(bool); } + public bool? NotificationSettingSendToAllMarketplaceAdmin { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).NotificationSettingSendToAllMarketplaceAdmin; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).NotificationSettingSendToAllMarketplaceAdmin = value ?? default(bool); } /// Private Store id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string PrivateStoreId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).PrivateStoreId; } + public string PrivateStoreId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).PrivateStoreId; } /// Private Store Name [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string PrivateStoreName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).PrivateStoreName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).PrivateStoreName = value ?? null; } + public string PrivateStoreName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).PrivateStoreName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).PrivateStoreName = value ?? null; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreProperties _property; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreProperties _property; /// The PrivateStore data structure. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStoreProperties()); set => this._property = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStoreProperties()); set => this._property = value; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } /// Metadata pertaining to creation and last modification of the resource [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemData; } + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemData; } /// The timestamp of resource creation (UTC) [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } /// The identity that created the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedBy = value ?? null; } + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedBy = value ?? null; } /// The type of identity that created the resource [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType)""); } + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedByType = value ?? null; } /// The timestamp of resource last modification (UTC) [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } /// The identity that last modified the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedBy = value ?? null; } + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedBy = value ?? null; } /// The type of identity that last modified the resource [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType)""); } + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedByType = value ?? null; } /// Tenant id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string TenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)Property).TenantId = value ?? null; } + public string TenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)Property).TenantId = value ?? null; } /// The type of the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Type; } + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Type; } /// Creates an new instance. public PrivateStore() @@ -140,7 +143,7 @@ public PrivateStore() /// an instance that will receive validation /// events. /// - /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// A that will be complete when validation is completed. /// public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { @@ -151,36 +154,49 @@ public PrivateStore() /// The PrivateStore data structure. public partial interface IPrivateStore : Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResource + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResource { /// Indicates private store availability [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Indicates private store availability", SerializedName = @"availability", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability? Availability { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("enabled", "disabled")] + string Availability { get; set; } /// Gets or sets list of branding characteristics [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets list of branding characteristics", SerializedName = @"branding", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding Branding { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding) })] + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding Branding { get; set; } /// Gets list of associated collection ids [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets list of associated collection ids", SerializedName = @"collectionIds", PossibleTypes = new [] { typeof(string) })] - string[] CollectionId { get; } + System.Collections.Generic.List CollectionId { get; } /// Identifier for purposes of race condition [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Identifier for purposes of race condition", SerializedName = @"eTag", PossibleTypes = new [] { typeof(string) })] @@ -189,6 +205,9 @@ public partial interface IPrivateStore : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Is government", SerializedName = @"isGov", PossibleTypes = new [] { typeof(bool) })] @@ -197,14 +216,20 @@ public partial interface IPrivateStore : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets list of notified recipients for new requests", SerializedName = @"recipients", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[] NotificationSettingRecipient { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient) })] + System.Collections.Generic.List NotificationSettingRecipient { get; set; } /// Gets or sets whether to send email to all marketplace admins for new requests [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets whether to send email to all marketplace admins for new requests", SerializedName = @"sendToAllMarketplaceAdmins", PossibleTypes = new [] { typeof(bool) })] @@ -213,6 +238,9 @@ public partial interface IPrivateStore : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Private Store id", SerializedName = @"privateStoreId", PossibleTypes = new [] { typeof(string) })] @@ -221,6 +249,9 @@ public partial interface IPrivateStore : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Private Store Name", SerializedName = @"privateStoreName", PossibleTypes = new [] { typeof(string) })] @@ -229,6 +260,9 @@ public partial interface IPrivateStore : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Tenant id", SerializedName = @"tenantId", PossibleTypes = new [] { typeof(string) })] @@ -237,30 +271,31 @@ public partial interface IPrivateStore : } /// The PrivateStore data structure. internal partial interface IPrivateStoreInternal : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal { /// Indicates private store availability - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability? Availability { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("enabled", "disabled")] + string Availability { get; set; } /// Gets or sets list of branding characteristics - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding Branding { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding Branding { get; set; } /// Gets list of associated collection ids - string[] CollectionId { get; set; } + System.Collections.Generic.List CollectionId { get; set; } /// Identifier for purposes of race condition string ETag { get; set; } /// Is government bool? IsGov { get; set; } /// Gets or sets list of notified recipients for new requests - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[] NotificationSettingRecipient { get; set; } + System.Collections.Generic.List NotificationSettingRecipient { get; set; } /// Gets or sets whether to send email to all marketplace admins for new requests bool? NotificationSettingSendToAllMarketplaceAdmin { get; set; } /// Gets or sets notifications settings - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsProperties NotificationsSetting { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsProperties NotificationsSetting { get; set; } /// Private Store id string PrivateStoreId { get; set; } /// Private Store Name string PrivateStoreName { get; set; } /// The PrivateStore data structure. - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreProperties Property { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreProperties Property { get; set; } /// Tenant id string TenantId { get; set; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStore.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStore.json.cs similarity index 88% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStore.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStore.json.cs index 9efde810c3cb..8c45d510ea52 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStore.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStore.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class PrivateStore partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class PrivateStore /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class PrivateStore /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class PrivateStore partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new PrivateStore(json) : null; } @@ -75,8 +77,8 @@ internal PrivateStore(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Jso { return; } - __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Resource(json); - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStoreProperties.FromJson(__jsonProperties) : Property;} + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStoreProperties.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreList.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreList.PowerShell.cs similarity index 68% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreList.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreList.PowerShell.cs index ad2b09d94c54..9dc9e65a5fa5 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreList.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreList.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -33,7 +33,8 @@ public partial class PrivateStoreList /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -45,7 +46,8 @@ public partial class PrivateStoreList /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -55,27 +57,35 @@ public partial class PrivateStoreList partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreList DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreList DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new PrivateStoreList(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new PrivateStoreList(content); } @@ -84,11 +94,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,17 +113,17 @@ internal PrivateStoreList(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreListInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreListInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStoreTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStoreTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreListInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreListInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -128,11 +138,11 @@ internal PrivateStoreList(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreListInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreListInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStoreTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStoreTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreListInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreListInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -141,6 +151,18 @@ internal PrivateStoreList(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Describes the json payload for the list of available private stores (between zero and one, inclusive) [System.ComponentModel.TypeConverter(typeof(PrivateStoreListTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreList.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreList.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreList.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreList.TypeConverter.cs index 9e097d2021a9..c58a8e909d93 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreList.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreList.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class PrivateStoreListTypeConverter : global::System.Management.A { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreList ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreList ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreList).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreList).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreList.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreList.cs similarity index 73% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreList.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreList.cs index d72d0293b89e..20d5e0b7f52d 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreList.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreList.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -11,8 +11,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 /// Describes the json payload for the list of available private stores (between zero and one, inclusive) /// public partial class PrivateStoreList : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreList, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreListInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreList, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreListInternal { /// Backing field for property. @@ -23,10 +23,10 @@ public partial class PrivateStoreList : public string NextLink { get => this._nextLink; set => this._nextLink = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore[] _value; + private System.Collections.Generic.List _value; [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore[] Value { get => this._value; set => this._value = value; } + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } /// Creates an new instance. public PrivateStoreList() @@ -42,6 +42,9 @@ public partial interface IPrivateStoreList : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"URL to get the next set of PrivateStore list results if there are any.", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -50,10 +53,13 @@ public partial interface IPrivateStoreList : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore[] Value { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore) })] + System.Collections.Generic.List Value { get; set; } } /// Describes the json payload for the list of available private stores (between zero and one, inclusive) @@ -63,7 +69,7 @@ internal partial interface IPrivateStoreListInternal /// URL to get the next set of PrivateStore list results if there are any. string NextLink { get; set; } - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreList.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreList.json.cs similarity index 85% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreList.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreList.json.cs index 87c2c250a0fc..58691b8990fe 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreList.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreList.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -22,7 +22,7 @@ public partial class PrivateStoreList partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -32,7 +32,8 @@ public partial class PrivateStoreList /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -44,7 +45,8 @@ public partial class PrivateStoreList /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -54,13 +56,13 @@ public partial class PrivateStoreList partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreList. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreList. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreList. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreList. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreList FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreList FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new PrivateStoreList(json) : null; } @@ -77,8 +79,8 @@ internal PrivateStoreList(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime { return; } - {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStore.FromJson(__u) )) ))() : null : Value;} - {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStore.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreNotificationsState.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreNotificationsState.PowerShell.cs similarity index 57% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreNotificationsState.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreNotificationsState.PowerShell.cs index 6b1019335d2f..410e5dac3bb9 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreNotificationsState.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreNotificationsState.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class PrivateStoreNotificationsState /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class PrivateStoreNotificationsState /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,29 +55,35 @@ public partial class PrivateStoreNotificationsState partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsState DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsState DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new PrivateStoreNotificationsState(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsState DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsState DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new PrivateStoreNotificationsState(content); } @@ -84,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsState FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsState FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,21 +111,21 @@ internal PrivateStoreNotificationsState(global::System.Collections.IDictionary c // actually deserialize if (content.Contains("StopSellNotification")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsStateInternal)this).StopSellNotification = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotifications[]) content.GetValueForProperty("StopSellNotification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsStateInternal)this).StopSellNotification, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.StopSellNotificationsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsStateInternal)this).StopSellNotification = (System.Collections.Generic.List) content.GetValueForProperty("StopSellNotification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsStateInternal)this).StopSellNotification, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.StopSellNotificationsTypeConverter.ConvertFrom)); } if (content.Contains("NewNotification")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsStateInternal)this).NewNotification = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotifications[]) content.GetValueForProperty("NewNotification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsStateInternal)this).NewNotification, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.NewNotificationsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsStateInternal)this).NewNotification = (System.Collections.Generic.List) content.GetValueForProperty("NewNotification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsStateInternal)this).NewNotification, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.NewNotificationsTypeConverter.ConvertFrom)); } if (content.Contains("ApprovalRequest")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsStateInternal)this).ApprovalRequest = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetails[]) content.GetValueForProperty("ApprovalRequest",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsStateInternal)this).ApprovalRequest, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalsDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsStateInternal)this).ApprovalRequest = (System.Collections.Generic.List) content.GetValueForProperty("ApprovalRequest",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsStateInternal)this).ApprovalRequest, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalsDetailsTypeConverter.ConvertFrom)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -132,15 +140,15 @@ internal PrivateStoreNotificationsState(global::System.Management.Automation.PSO // actually deserialize if (content.Contains("StopSellNotification")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsStateInternal)this).StopSellNotification = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotifications[]) content.GetValueForProperty("StopSellNotification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsStateInternal)this).StopSellNotification, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.StopSellNotificationsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsStateInternal)this).StopSellNotification = (System.Collections.Generic.List) content.GetValueForProperty("StopSellNotification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsStateInternal)this).StopSellNotification, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.StopSellNotificationsTypeConverter.ConvertFrom)); } if (content.Contains("NewNotification")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsStateInternal)this).NewNotification = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotifications[]) content.GetValueForProperty("NewNotification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsStateInternal)this).NewNotification, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.NewNotificationsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsStateInternal)this).NewNotification = (System.Collections.Generic.List) content.GetValueForProperty("NewNotification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsStateInternal)this).NewNotification, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.NewNotificationsTypeConverter.ConvertFrom)); } if (content.Contains("ApprovalRequest")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsStateInternal)this).ApprovalRequest = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetails[]) content.GetValueForProperty("ApprovalRequest",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsStateInternal)this).ApprovalRequest, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalsDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsStateInternal)this).ApprovalRequest = (System.Collections.Generic.List) content.GetValueForProperty("ApprovalRequest",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsStateInternal)this).ApprovalRequest, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalsDetailsTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } @@ -149,6 +157,18 @@ internal PrivateStoreNotificationsState(global::System.Management.Automation.PSO /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Get private store notifications state [System.ComponentModel.TypeConverter(typeof(PrivateStoreNotificationsStateTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreNotificationsState.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreNotificationsState.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreNotificationsState.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreNotificationsState.TypeConverter.cs index 174dcc38b52f..5da56f7111be 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreNotificationsState.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreNotificationsState.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class PrivateStoreNotificationsStateTypeConverter : global::Syste { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,21 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsState ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsState ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsState).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsState).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreNotificationsState.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreNotificationsState.cs new file mode 100644 index 000000000000..fa9dc26a0256 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreNotificationsState.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Get private store notifications state + public partial class PrivateStoreNotificationsState : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsState, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsStateInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _approvalRequest; + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List ApprovalRequest { get => this._approvalRequest; set => this._approvalRequest = value; } + + /// Backing field for property. + private System.Collections.Generic.List _newNotification; + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List NewNotification { get => this._newNotification; set => this._newNotification = value; } + + /// Backing field for property. + private System.Collections.Generic.List _stopSellNotification; + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List StopSellNotification { get => this._stopSellNotification; set => this._stopSellNotification = value; } + + /// Creates an new instance. + public PrivateStoreNotificationsState() + { + + } + } + /// Get private store notifications state + public partial interface IPrivateStoreNotificationsState : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"", + SerializedName = @"approvalRequests", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetails) })] + System.Collections.Generic.List ApprovalRequest { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"", + SerializedName = @"newNotifications", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotifications) })] + System.Collections.Generic.List NewNotification { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"", + SerializedName = @"stopSellNotifications", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotifications) })] + System.Collections.Generic.List StopSellNotification { get; set; } + + } + /// Get private store notifications state + internal partial interface IPrivateStoreNotificationsStateInternal + + { + System.Collections.Generic.List ApprovalRequest { get; set; } + + System.Collections.Generic.List NewNotification { get; set; } + + System.Collections.Generic.List StopSellNotification { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreNotificationsState.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreNotificationsState.json.cs similarity index 79% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreNotificationsState.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreNotificationsState.json.cs index 50ad6e3b028f..41f92a06058c 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreNotificationsState.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreNotificationsState.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class PrivateStoreNotificationsState partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class PrivateStoreNotificationsState /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class PrivateStoreNotificationsState /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class PrivateStoreNotificationsState partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsState. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsState. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsState. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsState. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreNotificationsState FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreNotificationsState FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new PrivateStoreNotificationsState(json) : null; } @@ -75,9 +77,9 @@ internal PrivateStoreNotificationsState(Microsoft.Azure.PowerShell.Cmdlets.Marke { return; } - {_stopSellNotification = If( json?.PropertyT("stopSellNotifications"), out var __jsonStopSellNotifications) ? If( __jsonStopSellNotifications as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotifications) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.StopSellNotifications.FromJson(__u) )) ))() : null : StopSellNotification;} - {_newNotification = If( json?.PropertyT("newNotifications"), out var __jsonNewNotifications) ? If( __jsonNewNotifications as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INewNotifications) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.NewNotifications.FromJson(__p) )) ))() : null : NewNotification;} - {_approvalRequest = If( json?.PropertyT("approvalRequests"), out var __jsonApprovalRequests) ? If( __jsonApprovalRequests as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __l) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__l, (__k)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalsDetails.FromJson(__k) )) ))() : null : ApprovalRequest;} + {_stopSellNotification = If( json?.PropertyT("stopSellNotifications"), out var __jsonStopSellNotifications) ? If( __jsonStopSellNotifications as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotifications) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.StopSellNotifications.FromJson(__u) )) ))() : null : _stopSellNotification;} + {_newNotification = If( json?.PropertyT("newNotifications"), out var __jsonNewNotifications) ? If( __jsonNewNotifications as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewNotifications) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.NewNotifications.FromJson(__p) )) ))() : null : _newNotification;} + {_approvalRequest = If( json?.PropertyT("approvalRequests"), out var __jsonApprovalRequests) ? If( __jsonApprovalRequests as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __l) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__l, (__k)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalsDetails.FromJson(__k) )) ))() : null : _approvalRequest;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreProperties.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreProperties.PowerShell.cs similarity index 51% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreProperties.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreProperties.PowerShell.cs index a1cdba47212e..ecdb4fdbcd62 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreProperties.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreProperties.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -33,7 +33,8 @@ public partial class PrivateStoreProperties /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -45,7 +46,8 @@ public partial class PrivateStoreProperties /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -55,27 +57,35 @@ public partial class PrivateStoreProperties partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new PrivateStoreProperties(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new PrivateStoreProperties(content); } @@ -84,11 +94,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,53 +113,53 @@ internal PrivateStoreProperties(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("NotificationsSetting")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).NotificationsSetting = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsProperties) content.GetValueForProperty("NotificationsSetting",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).NotificationsSetting, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.NotificationsSettingsPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).NotificationsSetting = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsProperties) content.GetValueForProperty("NotificationsSetting",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).NotificationsSetting, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.NotificationsSettingsPropertiesTypeConverter.ConvertFrom); } if (content.Contains("Availability")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).Availability = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability?) content.GetValueForProperty("Availability",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).Availability, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).Availability = (string) content.GetValueForProperty("Availability",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).Availability, global::System.Convert.ToString); } if (content.Contains("PrivateStoreId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).PrivateStoreId = (string) content.GetValueForProperty("PrivateStoreId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).PrivateStoreId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).PrivateStoreId = (string) content.GetValueForProperty("PrivateStoreId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).PrivateStoreId, global::System.Convert.ToString); } if (content.Contains("ETag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).ETag, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).ETag, global::System.Convert.ToString); } if (content.Contains("PrivateStoreName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).PrivateStoreName = (string) content.GetValueForProperty("PrivateStoreName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).PrivateStoreName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).PrivateStoreName = (string) content.GetValueForProperty("PrivateStoreName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).PrivateStoreName, global::System.Convert.ToString); } if (content.Contains("TenantId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).TenantId = (string) content.GetValueForProperty("TenantId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).TenantId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).TenantId = (string) content.GetValueForProperty("TenantId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).TenantId, global::System.Convert.ToString); } if (content.Contains("IsGov")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).IsGov = (bool?) content.GetValueForProperty("IsGov",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).IsGov, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).IsGov = (bool?) content.GetValueForProperty("IsGov",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).IsGov, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("CollectionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).CollectionId = (string[]) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).CollectionId = (System.Collections.Generic.List) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("Branding")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).Branding = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding) content.GetValueForProperty("Branding",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).Branding, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStorePropertiesBrandingTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).Branding = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding) content.GetValueForProperty("Branding",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).Branding, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStorePropertiesBrandingTypeConverter.ConvertFrom); } if (content.Contains("NotificationSettingRecipient")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).NotificationSettingRecipient = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[]) content.GetValueForProperty("NotificationSettingRecipient",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).NotificationSettingRecipient, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RecipientTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).NotificationSettingRecipient = (System.Collections.Generic.List) content.GetValueForProperty("NotificationSettingRecipient",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).NotificationSettingRecipient, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RecipientTypeConverter.ConvertFrom)); } if (content.Contains("NotificationSettingSendToAllMarketplaceAdmin")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).NotificationSettingSendToAllMarketplaceAdmin = (bool?) content.GetValueForProperty("NotificationSettingSendToAllMarketplaceAdmin",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).NotificationSettingSendToAllMarketplaceAdmin, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).NotificationSettingSendToAllMarketplaceAdmin = (bool?) content.GetValueForProperty("NotificationSettingSendToAllMarketplaceAdmin",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).NotificationSettingSendToAllMarketplaceAdmin, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -164,47 +174,47 @@ internal PrivateStoreProperties(global::System.Management.Automation.PSObject co // actually deserialize if (content.Contains("NotificationsSetting")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).NotificationsSetting = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsProperties) content.GetValueForProperty("NotificationsSetting",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).NotificationsSetting, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.NotificationsSettingsPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).NotificationsSetting = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsProperties) content.GetValueForProperty("NotificationsSetting",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).NotificationsSetting, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.NotificationsSettingsPropertiesTypeConverter.ConvertFrom); } if (content.Contains("Availability")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).Availability = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability?) content.GetValueForProperty("Availability",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).Availability, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).Availability = (string) content.GetValueForProperty("Availability",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).Availability, global::System.Convert.ToString); } if (content.Contains("PrivateStoreId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).PrivateStoreId = (string) content.GetValueForProperty("PrivateStoreId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).PrivateStoreId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).PrivateStoreId = (string) content.GetValueForProperty("PrivateStoreId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).PrivateStoreId, global::System.Convert.ToString); } if (content.Contains("ETag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).ETag, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).ETag = (string) content.GetValueForProperty("ETag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).ETag, global::System.Convert.ToString); } if (content.Contains("PrivateStoreName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).PrivateStoreName = (string) content.GetValueForProperty("PrivateStoreName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).PrivateStoreName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).PrivateStoreName = (string) content.GetValueForProperty("PrivateStoreName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).PrivateStoreName, global::System.Convert.ToString); } if (content.Contains("TenantId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).TenantId = (string) content.GetValueForProperty("TenantId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).TenantId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).TenantId = (string) content.GetValueForProperty("TenantId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).TenantId, global::System.Convert.ToString); } if (content.Contains("IsGov")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).IsGov = (bool?) content.GetValueForProperty("IsGov",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).IsGov, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).IsGov = (bool?) content.GetValueForProperty("IsGov",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).IsGov, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("CollectionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).CollectionId = (string[]) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).CollectionId = (System.Collections.Generic.List) content.GetValueForProperty("CollectionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).CollectionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("Branding")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).Branding = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding) content.GetValueForProperty("Branding",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).Branding, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStorePropertiesBrandingTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).Branding = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding) content.GetValueForProperty("Branding",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).Branding, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStorePropertiesBrandingTypeConverter.ConvertFrom); } if (content.Contains("NotificationSettingRecipient")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).NotificationSettingRecipient = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[]) content.GetValueForProperty("NotificationSettingRecipient",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).NotificationSettingRecipient, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RecipientTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).NotificationSettingRecipient = (System.Collections.Generic.List) content.GetValueForProperty("NotificationSettingRecipient",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).NotificationSettingRecipient, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RecipientTypeConverter.ConvertFrom)); } if (content.Contains("NotificationSettingSendToAllMarketplaceAdmin")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).NotificationSettingSendToAllMarketplaceAdmin = (bool?) content.GetValueForProperty("NotificationSettingSendToAllMarketplaceAdmin",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal)this).NotificationSettingSendToAllMarketplaceAdmin, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).NotificationSettingSendToAllMarketplaceAdmin = (bool?) content.GetValueForProperty("NotificationSettingSendToAllMarketplaceAdmin",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal)this).NotificationSettingSendToAllMarketplaceAdmin, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } AfterDeserializePSObject(content); } @@ -213,6 +223,18 @@ internal PrivateStoreProperties(global::System.Management.Automation.PSObject co /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Describes the json payload on whether or not the private store is enabled for a given tenant [System.ComponentModel.TypeConverter(typeof(PrivateStorePropertiesTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreProperties.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreProperties.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreProperties.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreProperties.TypeConverter.cs index b73264c550c5..7728d06f6559 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreProperties.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreProperties.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class PrivateStorePropertiesTypeConverter : global::System.Manage { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreProperties.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreProperties.cs similarity index 68% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreProperties.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreProperties.cs index 9b10f51ce607..9edad02bbe34 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreProperties.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreProperties.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -11,30 +11,30 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 /// Describes the json payload on whether or not the private store is enabled for a given tenant /// public partial class PrivateStoreProperties : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreProperties, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreProperties, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability? _availability; + private string _availability; /// Indicates private store availability [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability? Availability { get => this._availability; set => this._availability = value; } + public string Availability { get => this._availability; set => this._availability = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding _branding; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding _branding; /// Gets or sets list of branding characteristics [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding Branding { get => (this._branding = this._branding ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStorePropertiesBranding()); set => this._branding = value; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding Branding { get => (this._branding = this._branding ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStorePropertiesBranding()); set => this._branding = value; } /// Backing field for property. - private string[] _collectionId; + private System.Collections.Generic.List _collectionId; /// Gets list of associated collection ids [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public string[] CollectionId { get => this._collectionId; } + public System.Collections.Generic.List CollectionId { get => this._collectionId; } /// Backing field for property. private string _eTag; @@ -51,28 +51,28 @@ public partial class PrivateStoreProperties : public bool? IsGov { get => this._isGov; set => this._isGov = value; } /// Internal Acessors for CollectionId - string[] Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal.CollectionId { get => this._collectionId; set { {_collectionId = value;} } } + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal.CollectionId { get => this._collectionId; set { {_collectionId = value;} } } /// Internal Acessors for NotificationsSetting - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsProperties Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal.NotificationsSetting { get => (this._notificationsSetting = this._notificationsSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.NotificationsSettingsProperties()); set { {_notificationsSetting = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsProperties Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal.NotificationsSetting { get => (this._notificationsSetting = this._notificationsSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.NotificationsSettingsProperties()); set { {_notificationsSetting = value;} } } /// Internal Acessors for PrivateStoreId - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesInternal.PrivateStoreId { get => this._privateStoreId; set { {_privateStoreId = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesInternal.PrivateStoreId { get => this._privateStoreId; set { {_privateStoreId = value;} } } /// Gets or sets list of notified recipients for new requests [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[] NotificationSettingRecipient { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsPropertiesInternal)NotificationsSetting).Recipient; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsPropertiesInternal)NotificationsSetting).Recipient = value ?? null /* arrayOf */; } + public System.Collections.Generic.List NotificationSettingRecipient { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsPropertiesInternal)NotificationsSetting).Recipient; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsPropertiesInternal)NotificationsSetting).Recipient = value ?? null /* arrayOf */; } /// Gets or sets whether to send email to all marketplace admins for new requests [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public bool? NotificationSettingSendToAllMarketplaceAdmin { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsPropertiesInternal)NotificationsSetting).SendToAllMarketplaceAdmin; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsPropertiesInternal)NotificationsSetting).SendToAllMarketplaceAdmin = value ?? default(bool); } + public bool? NotificationSettingSendToAllMarketplaceAdmin { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsPropertiesInternal)NotificationsSetting).SendToAllMarketplaceAdmin; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsPropertiesInternal)NotificationsSetting).SendToAllMarketplaceAdmin = value ?? default(bool); } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsProperties _notificationsSetting; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsProperties _notificationsSetting; /// Gets or sets notifications settings [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsProperties NotificationsSetting { get => (this._notificationsSetting = this._notificationsSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.NotificationsSettingsProperties()); set => this._notificationsSetting = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsProperties NotificationsSetting { get => (this._notificationsSetting = this._notificationsSetting ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.NotificationsSettingsProperties()); set => this._notificationsSetting = value; } /// Backing field for property. private string _privateStoreId; @@ -109,30 +109,43 @@ public partial interface IPrivateStoreProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Indicates private store availability", SerializedName = @"availability", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability? Availability { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("enabled", "disabled")] + string Availability { get; set; } /// Gets or sets list of branding characteristics [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets list of branding characteristics", SerializedName = @"branding", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding Branding { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding) })] + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding Branding { get; set; } /// Gets list of associated collection ids [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets list of associated collection ids", SerializedName = @"collectionIds", PossibleTypes = new [] { typeof(string) })] - string[] CollectionId { get; } + System.Collections.Generic.List CollectionId { get; } /// Identifier for purposes of race condition [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Identifier for purposes of race condition", SerializedName = @"eTag", PossibleTypes = new [] { typeof(string) })] @@ -141,6 +154,9 @@ public partial interface IPrivateStoreProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Is government", SerializedName = @"isGov", PossibleTypes = new [] { typeof(bool) })] @@ -149,14 +165,20 @@ public partial interface IPrivateStoreProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets list of notified recipients for new requests", SerializedName = @"recipients", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[] NotificationSettingRecipient { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient) })] + System.Collections.Generic.List NotificationSettingRecipient { get; set; } /// Gets or sets whether to send email to all marketplace admins for new requests [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets whether to send email to all marketplace admins for new requests", SerializedName = @"sendToAllMarketplaceAdmins", PossibleTypes = new [] { typeof(bool) })] @@ -165,6 +187,9 @@ public partial interface IPrivateStoreProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Private Store id", SerializedName = @"privateStoreId", PossibleTypes = new [] { typeof(string) })] @@ -173,6 +198,9 @@ public partial interface IPrivateStoreProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Private Store Name", SerializedName = @"privateStoreName", PossibleTypes = new [] { typeof(string) })] @@ -181,6 +209,9 @@ public partial interface IPrivateStoreProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Tenant id", SerializedName = @"tenantId", PossibleTypes = new [] { typeof(string) })] @@ -192,21 +223,22 @@ internal partial interface IPrivateStorePropertiesInternal { /// Indicates private store availability - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability? Availability { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("enabled", "disabled")] + string Availability { get; set; } /// Gets or sets list of branding characteristics - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding Branding { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding Branding { get; set; } /// Gets list of associated collection ids - string[] CollectionId { get; set; } + System.Collections.Generic.List CollectionId { get; set; } /// Identifier for purposes of race condition string ETag { get; set; } /// Is government bool? IsGov { get; set; } /// Gets or sets list of notified recipients for new requests - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[] NotificationSettingRecipient { get; set; } + System.Collections.Generic.List NotificationSettingRecipient { get; set; } /// Gets or sets whether to send email to all marketplace admins for new requests bool? NotificationSettingSendToAllMarketplaceAdmin { get; set; } /// Gets or sets notifications settings - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.INotificationsSettingsProperties NotificationsSetting { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INotificationsSettingsProperties NotificationsSetting { get; set; } /// Private Store id string PrivateStoreId { get; set; } /// Private Store Name diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreProperties.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreProperties.json.cs similarity index 85% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreProperties.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreProperties.json.cs index 48ae4ec06b3a..192c1ca5dc35 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStoreProperties.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStoreProperties.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -22,7 +22,7 @@ public partial class PrivateStoreProperties partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -32,7 +32,8 @@ public partial class PrivateStoreProperties /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -44,7 +45,8 @@ public partial class PrivateStoreProperties /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -54,13 +56,13 @@ public partial class PrivateStoreProperties partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStoreProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new PrivateStoreProperties(json) : null; } @@ -77,15 +79,15 @@ internal PrivateStoreProperties(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.R { return; } - {_notificationsSetting = If( json?.PropertyT("notificationsSettings"), out var __jsonNotificationsSettings) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.NotificationsSettingsProperties.FromJson(__jsonNotificationsSettings) : NotificationsSetting;} - {_availability = If( json?.PropertyT("availability"), out var __jsonAvailability) ? (string)__jsonAvailability : (string)Availability;} - {_privateStoreId = If( json?.PropertyT("privateStoreId"), out var __jsonPrivateStoreId) ? (string)__jsonPrivateStoreId : (string)PrivateStoreId;} - {_eTag = If( json?.PropertyT("eTag"), out var __jsonETag) ? (string)__jsonETag : (string)ETag;} - {_privateStoreName = If( json?.PropertyT("privateStoreName"), out var __jsonPrivateStoreName) ? (string)__jsonPrivateStoreName : (string)PrivateStoreName;} - {_tenantId = If( json?.PropertyT("tenantId"), out var __jsonTenantId) ? (string)__jsonTenantId : (string)TenantId;} - {_isGov = If( json?.PropertyT("isGov"), out var __jsonIsGov) ? (bool?)__jsonIsGov : IsGov;} - {_collectionId = If( json?.PropertyT("collectionIds"), out var __jsonCollectionIds) ? If( __jsonCollectionIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : CollectionId;} - {_branding = If( json?.PropertyT("branding"), out var __jsonBranding) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStorePropertiesBranding.FromJson(__jsonBranding) : Branding;} + {_notificationsSetting = If( json?.PropertyT("notificationsSettings"), out var __jsonNotificationsSettings) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.NotificationsSettingsProperties.FromJson(__jsonNotificationsSettings) : _notificationsSetting;} + {_availability = If( json?.PropertyT("availability"), out var __jsonAvailability) ? (string)__jsonAvailability : (string)_availability;} + {_privateStoreId = If( json?.PropertyT("privateStoreId"), out var __jsonPrivateStoreId) ? (string)__jsonPrivateStoreId : (string)_privateStoreId;} + {_eTag = If( json?.PropertyT("eTag"), out var __jsonETag) ? (string)__jsonETag : (string)_eTag;} + {_privateStoreName = If( json?.PropertyT("privateStoreName"), out var __jsonPrivateStoreName) ? (string)__jsonPrivateStoreName : (string)_privateStoreName;} + {_tenantId = If( json?.PropertyT("tenantId"), out var __jsonTenantId) ? (string)__jsonTenantId : (string)_tenantId;} + {_isGov = If( json?.PropertyT("isGov"), out var __jsonIsGov) ? (bool?)__jsonIsGov : _isGov;} + {_collectionId = If( json?.PropertyT("collectionIds"), out var __jsonCollectionIds) ? If( __jsonCollectionIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _collectionId;} + {_branding = If( json?.PropertyT("branding"), out var __jsonBranding) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStorePropertiesBranding.FromJson(__jsonBranding) : _branding;} AfterFromJson(json); } @@ -110,7 +112,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs } AddIf( null != this._notificationsSetting ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) this._notificationsSetting.ToJson(null,serializationMode) : null, "notificationsSettings" ,container.Add ); AddIf( null != (((object)this._availability)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._availability.ToString()) : null, "availability" ,container.Add ); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._privateStoreId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._privateStoreId.ToString()) : null, "privateStoreId" ,container.Add ); } @@ -118,7 +120,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs AddIf( null != (((object)this._privateStoreName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._privateStoreName.ToString()) : null, "privateStoreName" ,container.Add ); AddIf( null != (((object)this._tenantId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._tenantId.ToString()) : null, "tenantId" ,container.Add ); AddIf( null != this._isGov ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonBoolean((bool)this._isGov) : null, "isGov" ,container.Add ); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { if (null != this._collectionId) { diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStorePropertiesBranding.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStorePropertiesBranding.PowerShell.cs similarity index 77% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStorePropertiesBranding.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStorePropertiesBranding.PowerShell.cs index 9d7ed8a3567e..5deb1e0539fa 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStorePropertiesBranding.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStorePropertiesBranding.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class PrivateStorePropertiesBranding /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class PrivateStorePropertiesBranding /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,29 +55,35 @@ public partial class PrivateStorePropertiesBranding partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new PrivateStorePropertiesBranding(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new PrivateStorePropertiesBranding(content); } @@ -84,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -107,7 +115,7 @@ internal PrivateStorePropertiesBranding(global::System.Collections.IDictionary c } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -129,6 +137,18 @@ internal PrivateStorePropertiesBranding(global::System.Management.Automation.PSO /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Gets or sets list of branding characteristics [System.ComponentModel.TypeConverter(typeof(PrivateStorePropertiesBrandingTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStorePropertiesBranding.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStorePropertiesBranding.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStorePropertiesBranding.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStorePropertiesBranding.TypeConverter.cs index ecfdc23c4bb9..01451eaa4764 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStorePropertiesBranding.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStorePropertiesBranding.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class PrivateStorePropertiesBrandingTypeConverter : global::Syste { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,21 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStorePropertiesBranding.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStorePropertiesBranding.cs similarity index 79% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStorePropertiesBranding.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStorePropertiesBranding.cs index 63639bd97f7e..47fca526412c 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStorePropertiesBranding.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStorePropertiesBranding.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Gets or sets list of branding characteristics public partial class PrivateStorePropertiesBranding : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBrandingInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBrandingInternal { /// Creates an new instance. diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStorePropertiesBranding.dictionary.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStorePropertiesBranding.dictionary.cs similarity index 95% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStorePropertiesBranding.dictionary.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStorePropertiesBranding.dictionary.cs index eca7dfe511cb..0643909569e6 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStorePropertiesBranding.dictionary.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStorePropertiesBranding.dictionary.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -70,6 +70,6 @@ public void CopyFrom(global::System.Management.Automation.PSObject source) /// - public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStorePropertiesBranding source) => source.__additionalProperties; + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStorePropertiesBranding source) => source.__additionalProperties; } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStorePropertiesBranding.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStorePropertiesBranding.json.cs similarity index 89% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStorePropertiesBranding.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStorePropertiesBranding.json.cs index a13e2033b41b..ca0a0156c0b2 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/PrivateStorePropertiesBranding.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/PrivateStorePropertiesBranding.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class PrivateStorePropertiesBranding partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class PrivateStorePropertiesBranding /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class PrivateStorePropertiesBranding /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class PrivateStorePropertiesBranding partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new PrivateStorePropertiesBranding(json) : null; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlans.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlans.PowerShell.cs similarity index 63% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlans.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlans.PowerShell.cs index 6c8c64705c42..3c4e390f814a 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlans.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlans.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class QueryApprovedPlans /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class QueryApprovedPlans /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,27 +55,35 @@ public partial class QueryApprovedPlans partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlans DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlans DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new QueryApprovedPlans(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlans DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlans DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new QueryApprovedPlans(content); } @@ -82,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlans FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlans FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -101,17 +111,21 @@ internal QueryApprovedPlans(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("OfferId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansInternal)this).OfferId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansInternal)this).OfferId, global::System.Convert.ToString); } if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansInternal)this).PlanId = (string[]) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansInternal)this).PlanId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansInternal)this).PlanId = (System.Collections.Generic.List) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansInternal)this).PlanId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -126,11 +140,15 @@ internal QueryApprovedPlans(global::System.Management.Automation.PSObject conten // actually deserialize if (content.Contains("OfferId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansInternal)this).OfferId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansInternal)this).OfferId, global::System.Convert.ToString); } if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansInternal)this).PlanId = (string[]) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansInternal)this).PlanId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansInternal)this).PlanId = (System.Collections.Generic.List) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansInternal)this).PlanId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializePSObject(content); } @@ -139,6 +157,18 @@ internal QueryApprovedPlans(global::System.Management.Automation.PSObject conten /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Query approved plans details [System.ComponentModel.TypeConverter(typeof(QueryApprovedPlansTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlans.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlans.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlans.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlans.TypeConverter.cs index 41dae209d7cb..30bbef06f694 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlans.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlans.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class QueryApprovedPlansTypeConverter : global::System.Management { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlans ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlans ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlans).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlans).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlans.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlans.cs similarity index 56% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlans.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlans.cs index 8f1afd91b39a..5cc1e32c9dec 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlans.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlans.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Query approved plans details public partial class QueryApprovedPlans : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlans, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlans, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansInternal { /// Backing field for property. @@ -21,11 +21,18 @@ public partial class QueryApprovedPlans : public string OfferId { get => this._offerId; set => this._offerId = value; } /// Backing field for property. - private string[] _planId; + private System.Collections.Generic.List _planId; /// Offer plan ids [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public string[] PlanId { get => this._planId; set => this._planId = value; } + public System.Collections.Generic.List PlanId { get => this._planId; set => this._planId = value; } + + /// Backing field for property. + private System.Collections.Generic.List _subscriptionId; + + /// List of subscription IDs + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } /// Creates an new instance. public QueryApprovedPlans() @@ -41,6 +48,9 @@ public partial interface IQueryApprovedPlans : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Offer id", SerializedName = @"offerId", PossibleTypes = new [] { typeof(string) })] @@ -49,10 +59,24 @@ public partial interface IQueryApprovedPlans : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Offer plan ids", SerializedName = @"planIds", PossibleTypes = new [] { typeof(string) })] - string[] PlanId { get; set; } + System.Collections.Generic.List PlanId { get; set; } + /// List of subscription IDs + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of subscription IDs", + SerializedName = @"subscriptionIds", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List SubscriptionId { get; set; } } /// Query approved plans details @@ -62,7 +86,9 @@ internal partial interface IQueryApprovedPlansInternal /// Offer id string OfferId { get; set; } /// Offer plan ids - string[] PlanId { get; set; } + System.Collections.Generic.List PlanId { get; set; } + /// List of subscription IDs + System.Collections.Generic.List SubscriptionId { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlans.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlans.json.cs similarity index 75% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlans.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlans.json.cs index 425009315605..c57a7d9a4d29 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlans.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlans.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class QueryApprovedPlans partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class QueryApprovedPlans /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class QueryApprovedPlans /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class QueryApprovedPlans partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlans. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlans. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlans. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlans. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlans FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlans FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new QueryApprovedPlans(json) : null; } @@ -75,8 +77,9 @@ internal QueryApprovedPlans(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runti { return; } - {_offerId = If( json?.PropertyT("offerId"), out var __jsonOfferId) ? (string)__jsonOfferId : (string)OfferId;} - {_planId = If( json?.PropertyT("planIds"), out var __jsonPlanIds) ? If( __jsonPlanIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : PlanId;} + {_offerId = If( json?.PropertyT("offerId"), out var __jsonOfferId) ? (string)__jsonOfferId : (string)_offerId;} + {_planId = If( json?.PropertyT("planIds"), out var __jsonPlanIds) ? If( __jsonPlanIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _planId;} + {_subscriptionId = If( json?.PropertyT("subscriptionIds"), out var __jsonSubscriptionIds) ? If( __jsonSubscriptionIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : _subscriptionId;} AfterFromJson(json); } @@ -109,6 +112,15 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs } container.Add("planIds",__w); } + if (null != this._subscriptionId) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __s in this._subscriptionId ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("subscriptionIds",__r); + } AfterToJson(ref container); return container; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansDetails.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansDetails.PowerShell.cs similarity index 66% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansDetails.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansDetails.PowerShell.cs index 36d946373866..b5f46c87a321 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansDetails.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansDetails.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class QueryApprovedPlansDetails /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class QueryApprovedPlansDetails /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,29 +55,35 @@ public partial class QueryApprovedPlansDetails partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new QueryApprovedPlansDetails(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new QueryApprovedPlansDetails(content); } @@ -84,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,21 +111,21 @@ internal QueryApprovedPlansDetails(global::System.Collections.IDictionary conten // actually deserialize if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetailsInternal)this).PlanId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetailsInternal)this).PlanId, global::System.Convert.ToString); } if (content.Contains("SubscriptionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetailsInternal)this).SubscriptionId = (string[]) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetailsInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetailsInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetailsInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("AllSubscription")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetailsInternal)this).AllSubscription = (bool?) content.GetValueForProperty("AllSubscription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetailsInternal)this).AllSubscription, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetailsInternal)this).AllSubscription = (bool?) content.GetValueForProperty("AllSubscription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetailsInternal)this).AllSubscription, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -132,15 +140,15 @@ internal QueryApprovedPlansDetails(global::System.Management.Automation.PSObject // actually deserialize if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetailsInternal)this).PlanId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetailsInternal)this).PlanId, global::System.Convert.ToString); } if (content.Contains("SubscriptionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetailsInternal)this).SubscriptionId = (string[]) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetailsInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetailsInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetailsInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("AllSubscription")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetailsInternal)this).AllSubscription = (bool?) content.GetValueForProperty("AllSubscription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetailsInternal)this).AllSubscription, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetailsInternal)this).AllSubscription = (bool?) content.GetValueForProperty("AllSubscription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetailsInternal)this).AllSubscription, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } AfterDeserializePSObject(content); } @@ -149,6 +157,18 @@ internal QueryApprovedPlansDetails(global::System.Management.Automation.PSObject /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Query approved plans response [System.ComponentModel.TypeConverter(typeof(QueryApprovedPlansDetailsTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansDetails.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansDetails.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansDetails.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansDetails.TypeConverter.cs index 13c1189be739..82f75a51a7e2 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansDetails.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansDetails.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class QueryApprovedPlansDetailsTypeConverter : global::System.Man { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetails ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetails ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetails).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetails).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansDetails.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansDetails.cs similarity index 85% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansDetails.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansDetails.cs index 96cae8442990..aa829ec10675 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansDetails.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansDetails.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Query approved plans response public partial class QueryApprovedPlansDetails : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetails, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetailsInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetails, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetailsInternal { /// Backing field for property. @@ -28,7 +28,7 @@ public partial class QueryApprovedPlansDetails : public string PlanId { get => this._planId; set => this._planId = value; } /// Backing field for property. - private string[] _subscriptionId; + private System.Collections.Generic.List _subscriptionId; /// /// Approved subscription ids list. In case all subscriptions are approved for a plan, allSubscriptions flag is true and list @@ -36,7 +36,7 @@ public partial class QueryApprovedPlansDetails : /// plan is not approved for any subscription. /// [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + public System.Collections.Generic.List SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } /// Creates an new instance. public QueryApprovedPlansDetails() @@ -52,6 +52,9 @@ public partial interface IQueryApprovedPlansDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Indicates whether all subscriptions are approved for this plan", SerializedName = @"allSubscriptions", PossibleTypes = new [] { typeof(bool) })] @@ -60,6 +63,9 @@ public partial interface IQueryApprovedPlansDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Plan id", SerializedName = @"planId", PossibleTypes = new [] { typeof(string) })] @@ -72,10 +78,13 @@ public partial interface IQueryApprovedPlansDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Approved subscription ids list. In case all subscriptions are approved for a plan, allSubscriptions flag is true and list is empty ( else flag is set to false). In case both subscriptions list is empty and allSubscriptions flag is false, the plan is not approved for any subscription.", SerializedName = @"subscriptionIds", PossibleTypes = new [] { typeof(string) })] - string[] SubscriptionId { get; set; } + System.Collections.Generic.List SubscriptionId { get; set; } } /// Query approved plans response @@ -91,7 +100,7 @@ internal partial interface IQueryApprovedPlansDetailsInternal /// is empty ( else flag is set to false). In case both subscriptions list is empty and allSubscriptions flag is false, the /// plan is not approved for any subscription. /// - string[] SubscriptionId { get; set; } + System.Collections.Generic.List SubscriptionId { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansDetails.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansDetails.json.cs similarity index 86% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansDetails.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansDetails.json.cs index 38f4e538216d..b32dd31f9d3c 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansDetails.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansDetails.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class QueryApprovedPlansDetails partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class QueryApprovedPlansDetails /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class QueryApprovedPlansDetails /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class QueryApprovedPlansDetails partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetails. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetails. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetails. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetails. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new QueryApprovedPlansDetails(json) : null; } @@ -75,9 +77,9 @@ internal QueryApprovedPlansDetails(Microsoft.Azure.PowerShell.Cmdlets.Marketplac { return; } - {_planId = If( json?.PropertyT("planId"), out var __jsonPlanId) ? (string)__jsonPlanId : (string)PlanId;} - {_subscriptionId = If( json?.PropertyT("subscriptionIds"), out var __jsonSubscriptionIds) ? If( __jsonSubscriptionIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : SubscriptionId;} - {_allSubscription = If( json?.PropertyT("allSubscriptions"), out var __jsonAllSubscriptions) ? (bool?)__jsonAllSubscriptions : AllSubscription;} + {_planId = If( json?.PropertyT("planId"), out var __jsonPlanId) ? (string)__jsonPlanId : (string)_planId;} + {_subscriptionId = If( json?.PropertyT("subscriptionIds"), out var __jsonSubscriptionIds) ? If( __jsonSubscriptionIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _subscriptionId;} + {_allSubscription = If( json?.PropertyT("allSubscriptions"), out var __jsonAllSubscriptions) ? (bool?)__jsonAllSubscriptions : _allSubscription;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansPayload.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansPayload.PowerShell.cs similarity index 59% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansPayload.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansPayload.PowerShell.cs index f99eee33bb67..7a13901fa773 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansPayload.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansPayload.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class QueryApprovedPlansPayload /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class QueryApprovedPlansPayload /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,29 +55,35 @@ public partial class QueryApprovedPlansPayload partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayload DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayload DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new QueryApprovedPlansPayload(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayload DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayload DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new QueryApprovedPlansPayload(content); } @@ -84,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayload FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayload FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,21 +111,25 @@ internal QueryApprovedPlansPayload(global::System.Collections.IDictionary conten // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayloadInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlans) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayloadInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryApprovedPlansTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayloadInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlans) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayloadInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryApprovedPlansTypeConverter.ConvertFrom); } if (content.Contains("OfferId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayloadInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayloadInternal)this).OfferId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayloadInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayloadInternal)this).OfferId, global::System.Convert.ToString); } if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayloadInternal)this).PlanId = (string[]) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayloadInternal)this).PlanId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayloadInternal)this).PlanId = (System.Collections.Generic.List) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayloadInternal)this).PlanId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayloadInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayloadInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -132,15 +144,19 @@ internal QueryApprovedPlansPayload(global::System.Management.Automation.PSObject // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayloadInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlans) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayloadInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryApprovedPlansTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayloadInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlans) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayloadInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryApprovedPlansTypeConverter.ConvertFrom); } if (content.Contains("OfferId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayloadInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayloadInternal)this).OfferId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayloadInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayloadInternal)this).OfferId, global::System.Convert.ToString); } if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayloadInternal)this).PlanId = (string[]) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayloadInternal)this).PlanId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayloadInternal)this).PlanId = (System.Collections.Generic.List) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayloadInternal)this).PlanId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayloadInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayloadInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializePSObject(content); } @@ -149,6 +165,18 @@ internal QueryApprovedPlansPayload(global::System.Management.Automation.PSObject /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Query approved plans payload [System.ComponentModel.TypeConverter(typeof(QueryApprovedPlansPayloadTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansPayload.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansPayload.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansPayload.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansPayload.TypeConverter.cs index 356ee3eb5c73..03426735643b 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansPayload.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansPayload.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class QueryApprovedPlansPayloadTypeConverter : global::System.Man { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayload ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayload ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayload).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayload).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansPayload.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansPayload.cs new file mode 100644 index 000000000000..334954488833 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansPayload.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Query approved plans payload + public partial class QueryApprovedPlansPayload : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayload, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayloadInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlans Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayloadInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryApprovedPlans()); set { {_property = value;} } } + + /// Offer id + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public string OfferId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansInternal)Property).OfferId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansInternal)Property).OfferId = value ?? null; } + + /// Offer plan ids + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public System.Collections.Generic.List PlanId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansInternal)Property).PlanId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansInternal)Property).PlanId = value ?? null /* arrayOf */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlans _property; + + /// Query approved plans details + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlans Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryApprovedPlans()); set => this._property = value; } + + /// List of subscription IDs + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public System.Collections.Generic.List SubscriptionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansInternal)Property).SubscriptionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansInternal)Property).SubscriptionId = value ?? null /* arrayOf */; } + + /// Creates an new instance. + public QueryApprovedPlansPayload() + { + + } + } + /// Query approved plans payload + public partial interface IQueryApprovedPlansPayload : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + /// Offer id + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Offer id", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + string OfferId { get; set; } + /// Offer plan ids + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Offer plan ids", + SerializedName = @"planIds", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List PlanId { get; set; } + /// List of subscription IDs + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of subscription IDs", + SerializedName = @"subscriptionIds", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List SubscriptionId { get; set; } + + } + /// Query approved plans payload + internal partial interface IQueryApprovedPlansPayloadInternal + + { + /// Offer id + string OfferId { get; set; } + /// Offer plan ids + System.Collections.Generic.List PlanId { get; set; } + /// Query approved plans details + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlans Property { get; set; } + /// List of subscription IDs + System.Collections.Generic.List SubscriptionId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansPayload.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansPayload.json.cs similarity index 88% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansPayload.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansPayload.json.cs index 6adc0779589c..822584d4e1af 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansPayload.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansPayload.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class QueryApprovedPlansPayload partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class QueryApprovedPlansPayload /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class QueryApprovedPlansPayload /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class QueryApprovedPlansPayload partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayload. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayload. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayload. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayload. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansPayload FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansPayload FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new QueryApprovedPlansPayload(json) : null; } @@ -75,7 +77,7 @@ internal QueryApprovedPlansPayload(Microsoft.Azure.PowerShell.Cmdlets.Marketplac { return; } - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryApprovedPlans.FromJson(__jsonProperties) : Property;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryApprovedPlans.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansResponse.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansResponse.PowerShell.cs similarity index 68% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansResponse.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansResponse.PowerShell.cs index cbb3e0dcbd6f..b03649eaf6bb 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansResponse.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansResponse.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class QueryApprovedPlansResponse /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class QueryApprovedPlansResponse /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,29 +55,35 @@ public partial class QueryApprovedPlansResponse partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new QueryApprovedPlansResponse(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new QueryApprovedPlansResponse(content); } @@ -84,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,13 +111,13 @@ internal QueryApprovedPlansResponse(global::System.Collections.IDictionary conte // actually deserialize if (content.Contains("Detail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansResponseInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetails[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryApprovedPlansDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryApprovedPlansDetailsTypeConverter.ConvertFrom)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -124,7 +132,7 @@ internal QueryApprovedPlansResponse(global::System.Management.Automation.PSObjec // actually deserialize if (content.Contains("Detail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansResponseInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetails[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryApprovedPlansDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansResponseInternal)this).Detail = (System.Collections.Generic.List) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryApprovedPlansDetailsTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } @@ -133,6 +141,18 @@ internal QueryApprovedPlansResponse(global::System.Management.Automation.PSObjec /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Query approved plans response [System.ComponentModel.TypeConverter(typeof(QueryApprovedPlansResponseTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansResponse.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansResponse.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansResponse.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansResponse.TypeConverter.cs index 7331077e74f4..2e8369c62558 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansResponse.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansResponse.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class QueryApprovedPlansResponseTypeConverter : global::System.Ma { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansResponse ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansResponse ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansResponse).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansResponse).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansResponse.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansResponse.cs similarity index 66% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansResponse.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansResponse.cs index 0f8e19e78417..858684804b1b 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansResponse.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansResponse.cs @@ -3,24 +3,24 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Query approved plans response public partial class QueryApprovedPlansResponse : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansResponse, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansResponseInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansResponse, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansResponseInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetails[] _detail; + private System.Collections.Generic.List _detail; /// /// A list indicating for each plan which subscriptions are approved. Plan Id is unique /// [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetails[] Detail { get => this._detail; set => this._detail = value; } + public System.Collections.Generic.List Detail { get => this._detail; set => this._detail = value; } /// Creates an new instance. public QueryApprovedPlansResponse() @@ -38,10 +38,13 @@ public partial interface IQueryApprovedPlansResponse : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"A list indicating for each plan which subscriptions are approved. Plan Id is unique", SerializedName = @"details", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetails) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetails[] Detail { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetails) })] + System.Collections.Generic.List Detail { get; set; } } /// Query approved plans response @@ -51,7 +54,7 @@ internal partial interface IQueryApprovedPlansResponseInternal /// /// A list indicating for each plan which subscriptions are approved. Plan Id is unique /// - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetails[] Detail { get; set; } + System.Collections.Generic.List Detail { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansResponse.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansResponse.json.cs similarity index 84% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansResponse.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansResponse.json.cs index 6a5dfc8aabfd..21df536cc4bd 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryApprovedPlansResponse.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryApprovedPlansResponse.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class QueryApprovedPlansResponse partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class QueryApprovedPlansResponse /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class QueryApprovedPlansResponse /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class QueryApprovedPlansResponse partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansResponse. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansResponse. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansResponse. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansResponse. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new QueryApprovedPlansResponse(json) : null; } @@ -75,7 +77,7 @@ internal QueryApprovedPlansResponse(Microsoft.Azure.PowerShell.Cmdlets.Marketpla { return; } - {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? If( __jsonDetails as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryApprovedPlansDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryApprovedPlansDetails.FromJson(__u) )) ))() : null : Detail;} + {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? If( __jsonDetails as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryApprovedPlansDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryApprovedPlansDetails.FromJson(__u) )) ))() : null : _detail;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryOffers.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryOffers.PowerShell.cs similarity index 67% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryOffers.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryOffers.PowerShell.cs index dcb5d28bfd7b..245566da250c 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryOffers.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryOffers.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class QueryOffers /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class QueryOffers /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,27 +55,35 @@ public partial class QueryOffers partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffers DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new QueryOffers(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffers DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new QueryOffers(content); } @@ -82,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffers FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -101,17 +111,17 @@ internal QueryOffers(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffersInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffersInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferPropertiesTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffersInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffersInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferPropertiesTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffersInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffersInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffersInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffersInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -126,11 +136,11 @@ internal QueryOffers(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffersInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffersInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferPropertiesTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffersInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffersInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferPropertiesTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffersInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffersInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffersInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffersInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -139,6 +149,18 @@ internal QueryOffers(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// List of offers [System.ComponentModel.TypeConverter(typeof(QueryOffersTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryOffers.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryOffers.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryOffers.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryOffers.TypeConverter.cs index be627528b237..7b2c85e2962c 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryOffers.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryOffers.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class QueryOffersTypeConverter : global::System.Management.Automa { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffers ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffers).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryOffers.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryOffers.cs similarity index 70% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryOffers.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryOffers.cs index d9e52ca1ec8a..867340f0e8d8 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryOffers.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryOffers.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// List of offers public partial class QueryOffers : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffers, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffersInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffersInternal { /// Backing field for property. @@ -21,10 +21,10 @@ public partial class QueryOffers : public string NextLink { get => this._nextLink; set => this._nextLink = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties[] _value; + private System.Collections.Generic.List _value; [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties[] Value { get => this._value; set => this._value = value; } + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } /// Creates an new instance. public QueryOffers() @@ -40,6 +40,9 @@ public partial interface IQueryOffers : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"URL to get the next set of PrivateStore list results if there are any.", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -48,10 +51,13 @@ public partial interface IQueryOffers : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties[] Value { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties) })] + System.Collections.Generic.List Value { get; set; } } /// List of offers @@ -61,7 +67,7 @@ internal partial interface IQueryOffersInternal /// URL to get the next set of PrivateStore list results if there are any. string NextLink { get; set; } - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryOffers.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryOffers.json.cs similarity index 85% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryOffers.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryOffers.json.cs index 3c6d9ba74684..ff99d6fcd035 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryOffers.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryOffers.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class QueryOffers partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class QueryOffers /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class QueryOffers /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class QueryOffers partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffers. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffers. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffers FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new QueryOffers(json) : null; } @@ -75,8 +77,8 @@ internal QueryOffers(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json { return; } - {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferProperties) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.OfferProperties.FromJson(__u) )) ))() : null : Value;} - {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferProperties) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.OfferProperties.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApproval.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApproval.PowerShell.cs similarity index 64% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApproval.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApproval.PowerShell.cs index 25fb6d7c722b..dc587de8e2b2 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApproval.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApproval.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -34,7 +34,8 @@ public partial class QueryRequestApproval /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -46,7 +47,8 @@ public partial class QueryRequestApproval /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -56,27 +58,35 @@ public partial class QueryRequestApproval partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApproval DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApproval DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new QueryRequestApproval(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApproval DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApproval DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new QueryRequestApproval(content); } @@ -85,11 +95,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApproval FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApproval FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -104,25 +114,25 @@ internal QueryRequestApproval(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("UniqueOfferId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalInternal)this).UniqueOfferId = (string) content.GetValueForProperty("UniqueOfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalInternal)this).UniqueOfferId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalInternal)this).UniqueOfferId = (string) content.GetValueForProperty("UniqueOfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalInternal)this).UniqueOfferId, global::System.Convert.ToString); } if (content.Contains("PlansDetail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalInternal)this).PlansDetail = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPlansDetails) content.GetValueForProperty("PlansDetail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalInternal)this).PlansDetail, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryRequestApprovalPlansDetailsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalInternal)this).PlansDetail = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPlansDetails) content.GetValueForProperty("PlansDetail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalInternal)this).PlansDetail, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryRequestApprovalPlansDetailsTypeConverter.ConvertFrom); } if (content.Contains("Etag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalInternal)this).Etag = (string) content.GetValueForProperty("Etag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalInternal)this).Etag, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalInternal)this).Etag = (string) content.GetValueForProperty("Etag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalInternal)this).Etag, global::System.Convert.ToString); } if (content.Contains("MessageCode")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -137,19 +147,19 @@ internal QueryRequestApproval(global::System.Management.Automation.PSObject cont // actually deserialize if (content.Contains("UniqueOfferId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalInternal)this).UniqueOfferId = (string) content.GetValueForProperty("UniqueOfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalInternal)this).UniqueOfferId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalInternal)this).UniqueOfferId = (string) content.GetValueForProperty("UniqueOfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalInternal)this).UniqueOfferId, global::System.Convert.ToString); } if (content.Contains("PlansDetail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalInternal)this).PlansDetail = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPlansDetails) content.GetValueForProperty("PlansDetail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalInternal)this).PlansDetail, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryRequestApprovalPlansDetailsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalInternal)this).PlansDetail = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPlansDetails) content.GetValueForProperty("PlansDetail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalInternal)this).PlansDetail, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryRequestApprovalPlansDetailsTypeConverter.ConvertFrom); } if (content.Contains("Etag")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalInternal)this).Etag = (string) content.GetValueForProperty("Etag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalInternal)this).Etag, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalInternal)this).Etag = (string) content.GetValueForProperty("Etag",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalInternal)this).Etag, global::System.Convert.ToString); } if (content.Contains("MessageCode")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); } AfterDeserializePSObject(content); } @@ -158,6 +168,18 @@ internal QueryRequestApproval(global::System.Management.Automation.PSObject cont /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Gets the request plans with indication on each plan whether is approved by the admin, has pending request or not requested /// yet diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApproval.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApproval.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApproval.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApproval.TypeConverter.cs index c9f94ed507b7..c5822d9d1209 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApproval.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApproval.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class QueryRequestApprovalTypeConverter : global::System.Manageme { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApproval ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApproval ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApproval).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApproval).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApproval.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApproval.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApproval.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApproval.cs index f097a01e72e4..b603fcf01d87 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApproval.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApproval.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -12,8 +12,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 /// yet /// public partial class QueryRequestApproval : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApproval, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApproval, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalInternal { /// Backing field for property. @@ -31,11 +31,11 @@ public partial class QueryRequestApproval : public long? MessageCode { get => this._messageCode; set => this._messageCode = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPlansDetails _plansDetail; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPlansDetails _plansDetail; /// Gets or sets the plans details [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPlansDetails PlansDetail { get => (this._plansDetail = this._plansDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryRequestApprovalPlansDetails()); set => this._plansDetail = value; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPlansDetails PlansDetail { get => (this._plansDetail = this._plansDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryRequestApprovalPlansDetails()); set => this._plansDetail = value; } /// Backing field for property. private string _uniqueOfferId; @@ -59,6 +59,9 @@ public partial interface IQueryRequestApproval : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets e-tag field ", SerializedName = @"etag", PossibleTypes = new [] { typeof(string) })] @@ -67,6 +70,9 @@ public partial interface IQueryRequestApproval : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the notification message id", SerializedName = @"messageCode", PossibleTypes = new [] { typeof(long) })] @@ -75,14 +81,20 @@ public partial interface IQueryRequestApproval : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the plans details", SerializedName = @"plansDetails", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPlansDetails) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPlansDetails PlansDetail { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPlansDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPlansDetails PlansDetail { get; set; } /// Gets or sets unique offer id. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets unique offer id.", SerializedName = @"uniqueOfferId", PossibleTypes = new [] { typeof(string) })] @@ -99,7 +111,7 @@ internal partial interface IQueryRequestApprovalInternal /// Gets or sets the notification message id long? MessageCode { get; set; } /// Gets or sets the plans details - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPlansDetails PlansDetail { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPlansDetails PlansDetail { get; set; } /// Gets or sets unique offer id. string UniqueOfferId { get; set; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApproval.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApproval.json.cs similarity index 89% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApproval.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApproval.json.cs index c5e578e9c2df..ac36622729f1 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApproval.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApproval.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -23,7 +23,7 @@ public partial class QueryRequestApproval partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -33,7 +33,8 @@ public partial class QueryRequestApproval /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -45,7 +46,8 @@ public partial class QueryRequestApproval /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -55,13 +57,13 @@ public partial class QueryRequestApproval partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApproval. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApproval. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApproval. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApproval. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApproval FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApproval FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new QueryRequestApproval(json) : null; } @@ -78,10 +80,10 @@ internal QueryRequestApproval(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Run { return; } - {_uniqueOfferId = If( json?.PropertyT("uniqueOfferId"), out var __jsonUniqueOfferId) ? (string)__jsonUniqueOfferId : (string)UniqueOfferId;} - {_plansDetail = If( json?.PropertyT("plansDetails"), out var __jsonPlansDetails) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryRequestApprovalPlansDetails.FromJson(__jsonPlansDetails) : PlansDetail;} - {_etag = If( json?.PropertyT("etag"), out var __jsonEtag) ? (string)__jsonEtag : (string)Etag;} - {_messageCode = If( json?.PropertyT("messageCode"), out var __jsonMessageCode) ? (long?)__jsonMessageCode : MessageCode;} + {_uniqueOfferId = If( json?.PropertyT("uniqueOfferId"), out var __jsonUniqueOfferId) ? (string)__jsonUniqueOfferId : (string)_uniqueOfferId;} + {_plansDetail = If( json?.PropertyT("plansDetails"), out var __jsonPlansDetails) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryRequestApprovalPlansDetails.FromJson(__jsonPlansDetails) : _plansDetail;} + {_etag = If( json?.PropertyT("etag"), out var __jsonEtag) ? (string)__jsonEtag : (string)_etag;} + {_messageCode = If( json?.PropertyT("messageCode"), out var __jsonMessageCode) ? (long?)__jsonMessageCode : _messageCode;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalPlansDetails.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalPlansDetails.PowerShell.cs similarity index 76% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalPlansDetails.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalPlansDetails.PowerShell.cs index 7a2384f3fe56..90240ad58ffc 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalPlansDetails.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalPlansDetails.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class QueryRequestApprovalPlansDetails /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class QueryRequestApprovalPlansDetails /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,29 +55,35 @@ public partial class QueryRequestApprovalPlansDetails partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPlansDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPlansDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new QueryRequestApprovalPlansDetails(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPlansDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPlansDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new QueryRequestApprovalPlansDetails(content); } @@ -84,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPlansDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPlansDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -107,7 +115,7 @@ internal QueryRequestApprovalPlansDetails(global::System.Collections.IDictionary } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -129,6 +137,18 @@ internal QueryRequestApprovalPlansDetails(global::System.Management.Automation.P /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Gets or sets the plans details [System.ComponentModel.TypeConverter(typeof(QueryRequestApprovalPlansDetailsTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalPlansDetails.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalPlansDetails.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalPlansDetails.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalPlansDetails.TypeConverter.cs index b6e99ac93d3f..4cbb58097aaf 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalPlansDetails.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalPlansDetails.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class QueryRequestApprovalPlansDetailsTypeConverter : global::Sys { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,21 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPlansDetails ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPlansDetails ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPlansDetails).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPlansDetails).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalPlansDetails.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalPlansDetails.cs similarity index 77% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalPlansDetails.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalPlansDetails.cs index 672b1a7d40af..4bb5dd90a65c 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalPlansDetails.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalPlansDetails.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Gets or sets the plans details public partial class QueryRequestApprovalPlansDetails : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPlansDetails, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPlansDetailsInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPlansDetails, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPlansDetailsInternal { /// Creates an new instance. @@ -22,7 +22,7 @@ public QueryRequestApprovalPlansDetails() /// Gets or sets the plans details public partial interface IQueryRequestApprovalPlansDetails : Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray { } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalPlansDetails.dictionary.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalPlansDetails.dictionary.cs similarity index 68% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalPlansDetails.dictionary.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalPlansDetails.dictionary.cs index ff80812bb168..106313ecc8b3 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalPlansDetails.dictionary.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalPlansDetails.dictionary.cs @@ -3,28 +3,28 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; public partial class QueryRequestApprovalPlansDetails : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray { - protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); - global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } - int Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + int Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } - global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } - global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetails this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } /// /// - public void Add(global::System.String key, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails value) => __additionalProperties.Add( key, value); + public void Add(global::System.String key, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetails value) => __additionalProperties.Add( key, value); public void Clear() => __additionalProperties.Clear(); @@ -40,7 +40,7 @@ public void CopyFrom(global::System.Collections.IDictionary source) { if ((null != property.Key && null != property.Value)) { - this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); } } } @@ -55,7 +55,7 @@ public void CopyFrom(global::System.Management.Automation.PSObject source) { if ((null != property.Key && null != property.Value)) { - this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); } } } @@ -66,10 +66,10 @@ public void CopyFrom(global::System.Management.Automation.PSObject source) /// /// - public bool TryGetValue(global::System.String key, out Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails value) => __additionalProperties.TryGetValue( key, out value); + public bool TryGetValue(global::System.String key, out Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetails value) => __additionalProperties.TryGetValue( key, out value); /// - public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.QueryRequestApprovalPlansDetails source) => source.__additionalProperties; + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryRequestApprovalPlansDetails source) => source.__additionalProperties; } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalPlansDetails.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalPlansDetails.json.cs similarity index 86% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalPlansDetails.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalPlansDetails.json.cs index 79899a505c58..97233389309a 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalPlansDetails.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalPlansDetails.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class QueryRequestApprovalPlansDetails partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class QueryRequestApprovalPlansDetails /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class QueryRequestApprovalPlansDetails /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class QueryRequestApprovalPlansDetails partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPlansDetails. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPlansDetails. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPlansDetails. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPlansDetails. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPlansDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPlansDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new QueryRequestApprovalPlansDetails(json) : null; } @@ -76,7 +78,7 @@ internal QueryRequestApprovalPlansDetails(Microsoft.Azure.PowerShell.Cmdlets.Mar { return; } - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray)this).AdditionalProperties, (j) => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanDetails.FromJson(j) ,exclusions ); + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray)this).AdditionalProperties, (j) => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanDetails.FromJson(j) ,exclusions ); AfterFromJson(json); } @@ -99,7 +101,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs { return container; } - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray)this).AdditionalProperties, container); + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IAssociativeArray)this).AdditionalProperties, container); AfterToJson(ref container); return container; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalProperties.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalProperties.PowerShell.cs similarity index 62% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalProperties.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalProperties.PowerShell.cs index 32f0352b9ccd..b4caa5941fd1 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalProperties.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalProperties.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class QueryRequestApprovalProperties /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class QueryRequestApprovalProperties /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,29 +55,35 @@ public partial class QueryRequestApprovalProperties partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new QueryRequestApprovalProperties(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new QueryRequestApprovalProperties(content); } @@ -84,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,25 +111,25 @@ internal QueryRequestApprovalProperties(global::System.Collections.IDictionary c // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestDetailsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestDetailsTypeConverter.ConvertFrom); } if (content.Contains("PublisherId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPropertiesInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPropertiesInternal)this).PublisherId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPropertiesInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPropertiesInternal)this).PublisherId, global::System.Convert.ToString); } if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPropertiesInternal)this).PlanId = (string[]) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPropertiesInternal)this).PlanId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPropertiesInternal)this).PlanId = (System.Collections.Generic.List) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPropertiesInternal)this).PlanId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("SubscriptionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPropertiesInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPropertiesInternal)this).SubscriptionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPropertiesInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPropertiesInternal)this).SubscriptionId, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -136,19 +144,19 @@ internal QueryRequestApprovalProperties(global::System.Management.Automation.PSO // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestDetailsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestDetailsTypeConverter.ConvertFrom); } if (content.Contains("PublisherId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPropertiesInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPropertiesInternal)this).PublisherId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPropertiesInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPropertiesInternal)this).PublisherId, global::System.Convert.ToString); } if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPropertiesInternal)this).PlanId = (string[]) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPropertiesInternal)this).PlanId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPropertiesInternal)this).PlanId = (System.Collections.Generic.List) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPropertiesInternal)this).PlanId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("SubscriptionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPropertiesInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPropertiesInternal)this).SubscriptionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPropertiesInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPropertiesInternal)this).SubscriptionId, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -157,6 +165,18 @@ internal QueryRequestApprovalProperties(global::System.Management.Automation.PSO /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The details to get the request plans statuses [System.ComponentModel.TypeConverter(typeof(QueryRequestApprovalPropertiesTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalProperties.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalProperties.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalProperties.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalProperties.TypeConverter.cs index 495563b3d9f3..f009c60c87e1 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalProperties.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalProperties.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class QueryRequestApprovalPropertiesTypeConverter : global::Syste { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,21 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalProperties.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalProperties.cs similarity index 64% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalProperties.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalProperties.cs index 06121cd3de16..b6090541ef4d 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalProperties.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalProperties.cs @@ -3,37 +3,37 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// The details to get the request plans statuses public partial class QueryRequestApprovalProperties : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalProperties, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalProperties, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPropertiesInternal { /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetails Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalPropertiesInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestDetails()); set { {_property = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetails Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalPropertiesInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestDetails()); set { {_property = value;} } } /// Current plans list [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string[] PlanId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetailsInternal)Property).PlanId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetailsInternal)Property).PlanId = value ?? null /* arrayOf */; } + public System.Collections.Generic.List PlanId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetailsInternal)Property).PlanId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetailsInternal)Property).PlanId = value ?? null /* arrayOf */; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetails _property; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetails _property; /// The details to get the request plans statuses [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetails Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestDetails()); set => this._property = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetails Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestDetails()); set => this._property = value; } /// The offer's publisher id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string PublisherId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetailsInternal)Property).PublisherId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetailsInternal)Property).PublisherId = value ?? null; } + public string PublisherId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetailsInternal)Property).PublisherId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetailsInternal)Property).PublisherId = value ?? null; } /// Gets or sets the subscription id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string SubscriptionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetailsInternal)Property).SubscriptionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetailsInternal)Property).SubscriptionId = value ?? null; } + public string SubscriptionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetailsInternal)Property).SubscriptionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetailsInternal)Property).SubscriptionId = value ?? null; } /// Creates an new instance. public QueryRequestApprovalProperties() @@ -49,14 +49,20 @@ public partial interface IQueryRequestApprovalProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Current plans list", SerializedName = @"planIds", PossibleTypes = new [] { typeof(string) })] - string[] PlanId { get; set; } + System.Collections.Generic.List PlanId { get; set; } /// The offer's publisher id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The offer's publisher id", SerializedName = @"publisherId", PossibleTypes = new [] { typeof(string) })] @@ -65,6 +71,9 @@ public partial interface IQueryRequestApprovalProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the subscription id", SerializedName = @"subscriptionId", PossibleTypes = new [] { typeof(string) })] @@ -76,9 +85,9 @@ internal partial interface IQueryRequestApprovalPropertiesInternal { /// Current plans list - string[] PlanId { get; set; } + System.Collections.Generic.List PlanId { get; set; } /// The details to get the request plans statuses - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetails Property { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetails Property { get; set; } /// The offer's publisher id string PublisherId { get; set; } /// Gets or sets the subscription id diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalProperties.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalProperties.json.cs similarity index 88% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalProperties.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalProperties.json.cs index 9efe81a3452d..61741ce46458 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/QueryRequestApprovalProperties.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryRequestApprovalProperties.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class QueryRequestApprovalProperties partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class QueryRequestApprovalProperties /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class QueryRequestApprovalProperties /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class QueryRequestApprovalProperties partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryRequestApprovalProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryRequestApprovalProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new QueryRequestApprovalProperties(json) : null; } @@ -75,7 +77,7 @@ internal QueryRequestApprovalProperties(Microsoft.Azure.PowerShell.Cmdlets.Marke { return; } - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestDetails.FromJson(__jsonProperties) : Property;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestDetails.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersDetails.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersDetails.PowerShell.cs new file mode 100644 index 000000000000..e0cac3101703 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersDetails.PowerShell.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// List of offers IDs and list of user's subscriptions IDs to query the user's approved offers + /// + [System.ComponentModel.TypeConverter(typeof(QueryUserOffersDetailsTypeConverter))] + public partial class QueryUserOffersDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new QueryUserOffersDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new QueryUserOffersDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal QueryUserOffersDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetailsInternal)this).OfferId = (System.Collections.Generic.List) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetailsInternal)this).OfferId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetailsInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetailsInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal QueryUserOffersDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetailsInternal)this).OfferId = (System.Collections.Generic.List) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetailsInternal)this).OfferId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetailsInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetailsInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// List of offers IDs and list of user's subscriptions IDs to query the user's approved offers + [System.ComponentModel.TypeConverter(typeof(QueryUserOffersDetailsTypeConverter))] + public partial interface IQueryUserOffersDetails + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersDetails.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersDetails.TypeConverter.cs new file mode 100644 index 000000000000..5830b1b58c46 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class QueryUserOffersDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return QueryUserOffersDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return QueryUserOffersDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return QueryUserOffersDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersDetails.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersDetails.cs new file mode 100644 index 000000000000..76f410a62b3c --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersDetails.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// + /// List of offers IDs and list of user's subscriptions IDs to query the user's approved offers + /// + public partial class QueryUserOffersDetails : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetails, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetailsInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _offerId; + + /// List of offer IDs + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List OfferId { get => this._offerId; set => this._offerId = value; } + + /// Backing field for property. + private System.Collections.Generic.List _subscriptionId; + + /// List of subscription IDs + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Creates an new instance. + public QueryUserOffersDetails() + { + + } + } + /// List of offers IDs and list of user's subscriptions IDs to query the user's approved offers + public partial interface IQueryUserOffersDetails : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + /// List of offer IDs + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of offer IDs", + SerializedName = @"offerIds", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List OfferId { get; set; } + /// List of subscription IDs + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of subscription IDs", + SerializedName = @"subscriptionIds", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List SubscriptionId { get; set; } + + } + /// List of offers IDs and list of user's subscriptions IDs to query the user's approved offers + internal partial interface IQueryUserOffersDetailsInternal + + { + /// List of offer IDs + System.Collections.Generic.List OfferId { get; set; } + /// List of subscription IDs + System.Collections.Generic.List SubscriptionId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersDetails.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersDetails.json.cs new file mode 100644 index 000000000000..85eda4dc4643 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersDetails.json.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// + /// List of offers IDs and list of user's subscriptions IDs to query the user's approved offers + /// + public partial class QueryUserOffersDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new QueryUserOffersDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal QueryUserOffersDetails(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_offerId = If( json?.PropertyT("offerIds"), out var __jsonOfferIds) ? If( __jsonOfferIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _offerId;} + {_subscriptionId = If( json?.PropertyT("subscriptionIds"), out var __jsonSubscriptionIds) ? If( __jsonSubscriptionIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : _subscriptionId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._offerId) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __x in this._offerId ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("offerIds",__w); + } + if (null != this._subscriptionId) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __s in this._subscriptionId ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("subscriptionIds",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersProperties.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersProperties.PowerShell.cs new file mode 100644 index 000000000000..6197cda46090 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersProperties.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// Query user's offers properties + [System.ComponentModel.TypeConverter(typeof(QueryUserOffersPropertiesTypeConverter))] + public partial class QueryUserOffersProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new QueryUserOffersProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new QueryUserOffersProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal QueryUserOffersProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryUserOffersDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("OfferId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersPropertiesInternal)this).OfferId = (System.Collections.Generic.List) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersPropertiesInternal)this).OfferId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersPropertiesInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersPropertiesInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal QueryUserOffersProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryUserOffersDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("OfferId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersPropertiesInternal)this).OfferId = (System.Collections.Generic.List) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersPropertiesInternal)this).OfferId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersPropertiesInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersPropertiesInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Query user's offers properties + [System.ComponentModel.TypeConverter(typeof(QueryUserOffersPropertiesTypeConverter))] + public partial interface IQueryUserOffersProperties + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersProperties.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersProperties.TypeConverter.cs new file mode 100644 index 000000000000..ba95d7b091e4 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class QueryUserOffersPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return QueryUserOffersProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return QueryUserOffersProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return QueryUserOffersProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersProperties.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersProperties.cs new file mode 100644 index 000000000000..162d3a3a644e --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersProperties.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Query user's offers properties + public partial class QueryUserOffersProperties : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersProperties, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersPropertiesInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetails Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersPropertiesInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryUserOffersDetails()); set { {_property = value;} } } + + /// List of offer IDs + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public System.Collections.Generic.List OfferId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetailsInternal)Property).OfferId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetailsInternal)Property).OfferId = value ?? null /* arrayOf */; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetails _property; + + /// Query user's offers details + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetails Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryUserOffersDetails()); set => this._property = value; } + + /// List of subscription IDs + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public System.Collections.Generic.List SubscriptionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetailsInternal)Property).SubscriptionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetailsInternal)Property).SubscriptionId = value ?? null /* arrayOf */; } + + /// Creates an new instance. + public QueryUserOffersProperties() + { + + } + } + /// Query user's offers properties + public partial interface IQueryUserOffersProperties : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + /// List of offer IDs + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of offer IDs", + SerializedName = @"offerIds", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List OfferId { get; set; } + /// List of subscription IDs + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of subscription IDs", + SerializedName = @"subscriptionIds", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List SubscriptionId { get; set; } + + } + /// Query user's offers properties + internal partial interface IQueryUserOffersPropertiesInternal + + { + /// List of offer IDs + System.Collections.Generic.List OfferId { get; set; } + /// Query user's offers details + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersDetails Property { get; set; } + /// List of subscription IDs + System.Collections.Generic.List SubscriptionId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersProperties.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersProperties.json.cs new file mode 100644 index 000000000000..6db6efca5d64 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserOffersProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Query user's offers properties + public partial class QueryUserOffersProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new QueryUserOffersProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal QueryUserOffersProperties(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryUserOffersDetails.FromJson(__jsonProperties) : _property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesDetails.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesDetails.PowerShell.cs new file mode 100644 index 000000000000..6621a69b2658 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesDetails.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// List of subscriptions IDs to query the user's rules + [System.ComponentModel.TypeConverter(typeof(QueryUserRulesDetailsTypeConverter))] + public partial class QueryUserRulesDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new QueryUserRulesDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new QueryUserRulesDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal QueryUserRulesDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetailsInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetailsInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal QueryUserRulesDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetailsInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetailsInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// List of subscriptions IDs to query the user's rules + [System.ComponentModel.TypeConverter(typeof(QueryUserRulesDetailsTypeConverter))] + public partial interface IQueryUserRulesDetails + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesDetails.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesDetails.TypeConverter.cs new file mode 100644 index 000000000000..c95d181f9f5c --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesDetails.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class QueryUserRulesDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return QueryUserRulesDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return QueryUserRulesDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return QueryUserRulesDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesDetails.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesDetails.cs new file mode 100644 index 000000000000..f66a06a1277c --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesDetails.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// List of subscriptions IDs to query the user's rules + public partial class QueryUserRulesDetails : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetails, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetailsInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _subscriptionId; + + /// List of subscription IDs + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Creates an new instance. + public QueryUserRulesDetails() + { + + } + } + /// List of subscriptions IDs to query the user's rules + public partial interface IQueryUserRulesDetails : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + /// List of subscription IDs + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of subscription IDs", + SerializedName = @"subscriptionIds", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List SubscriptionId { get; set; } + + } + /// List of subscriptions IDs to query the user's rules + internal partial interface IQueryUserRulesDetailsInternal + + { + /// List of subscription IDs + System.Collections.Generic.List SubscriptionId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesDetails.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesDetails.json.cs new file mode 100644 index 000000000000..fa18c8ea387a --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesDetails.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// List of subscriptions IDs to query the user's rules + public partial class QueryUserRulesDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new QueryUserRulesDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal QueryUserRulesDetails(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_subscriptionId = If( json?.PropertyT("subscriptionIds"), out var __jsonSubscriptionIds) ? If( __jsonSubscriptionIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _subscriptionId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._subscriptionId) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __x in this._subscriptionId ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("subscriptionIds",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesProperties.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesProperties.PowerShell.cs new file mode 100644 index 000000000000..36095d8df7b6 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesProperties.PowerShell.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// Query user's rules properties + [System.ComponentModel.TypeConverter(typeof(QueryUserRulesPropertiesTypeConverter))] + public partial class QueryUserRulesProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new QueryUserRulesProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new QueryUserRulesProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal QueryUserRulesProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryUserRulesDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesPropertiesInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesPropertiesInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal QueryUserRulesProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryUserRulesDetailsTypeConverter.ConvertFrom); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesPropertiesInternal)this).SubscriptionId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesPropertiesInternal)this).SubscriptionId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Query user's rules properties + [System.ComponentModel.TypeConverter(typeof(QueryUserRulesPropertiesTypeConverter))] + public partial interface IQueryUserRulesProperties + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesProperties.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesProperties.TypeConverter.cs new file mode 100644 index 000000000000..bf7e88b562e7 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class QueryUserRulesPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return QueryUserRulesProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return QueryUserRulesProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return QueryUserRulesProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesProperties.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesProperties.cs new file mode 100644 index 000000000000..694b9bc78591 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesProperties.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Query user's rules properties + public partial class QueryUserRulesProperties : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesProperties, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesPropertiesInternal + { + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetails Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesPropertiesInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryUserRulesDetails()); set { {_property = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetails _property; + + /// Query user's rules details + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetails Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryUserRulesDetails()); set => this._property = value; } + + /// List of subscription IDs + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] + public System.Collections.Generic.List SubscriptionId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetailsInternal)Property).SubscriptionId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetailsInternal)Property).SubscriptionId = value ?? null /* arrayOf */; } + + /// Creates an new instance. + public QueryUserRulesProperties() + { + + } + } + /// Query user's rules properties + public partial interface IQueryUserRulesProperties : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + /// List of subscription IDs + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"List of subscription IDs", + SerializedName = @"subscriptionIds", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List SubscriptionId { get; set; } + + } + /// Query user's rules properties + internal partial interface IQueryUserRulesPropertiesInternal + + { + /// Query user's rules details + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesDetails Property { get; set; } + /// List of subscription IDs + System.Collections.Generic.List SubscriptionId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesProperties.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesProperties.json.cs new file mode 100644 index 000000000000..2775de23f478 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/QueryUserRulesProperties.json.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Query user's rules properties + public partial class QueryUserRulesProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new QueryUserRulesProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal QueryUserRulesProperties(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryUserRulesDetails.FromJson(__jsonProperties) : _property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Recipient.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Recipient.PowerShell.cs similarity index 69% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Recipient.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/Recipient.PowerShell.cs index 2ab705ffb3b9..d57d5c29b92e 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Recipient.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Recipient.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class Recipient /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class Recipient /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,27 +55,35 @@ public partial class Recipient partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new Recipient(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new Recipient(content); } @@ -82,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -101,21 +111,21 @@ internal Recipient(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("PrincipalId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipientInternal)this).PrincipalId = (string) content.GetValueForProperty("PrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipientInternal)this).PrincipalId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipientInternal)this).PrincipalId = (string) content.GetValueForProperty("PrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipientInternal)this).PrincipalId, global::System.Convert.ToString); } if (content.Contains("EmailAddress")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipientInternal)this).EmailAddress = (string) content.GetValueForProperty("EmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipientInternal)this).EmailAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipientInternal)this).EmailAddress = (string) content.GetValueForProperty("EmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipientInternal)this).EmailAddress, global::System.Convert.ToString); } if (content.Contains("DisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipientInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipientInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipientInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipientInternal)this).DisplayName, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -130,15 +140,15 @@ internal Recipient(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("PrincipalId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipientInternal)this).PrincipalId = (string) content.GetValueForProperty("PrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipientInternal)this).PrincipalId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipientInternal)this).PrincipalId = (string) content.GetValueForProperty("PrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipientInternal)this).PrincipalId, global::System.Convert.ToString); } if (content.Contains("EmailAddress")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipientInternal)this).EmailAddress = (string) content.GetValueForProperty("EmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipientInternal)this).EmailAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipientInternal)this).EmailAddress = (string) content.GetValueForProperty("EmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipientInternal)this).EmailAddress, global::System.Convert.ToString); } if (content.Contains("DisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipientInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipientInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipientInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipientInternal)this).DisplayName, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -147,6 +157,18 @@ internal Recipient(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Describes the json payload for a notified recipient for new requests [System.ComponentModel.TypeConverter(typeof(RecipientTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Recipient.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Recipient.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Recipient.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/Recipient.TypeConverter.cs index a0f0f60a5978..88c6ad1a299a 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Recipient.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Recipient.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,19 @@ public partial class RecipientTypeConverter : global::System.Management.Automati { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +74,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +99,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Recipient.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Recipient.cs similarity index 85% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Recipient.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/Recipient.cs index e86da1428acd..d444affc7f86 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Recipient.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Recipient.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Describes the json payload for a notified recipient for new requests public partial class Recipient : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipientInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipientInternal { /// Backing field for property. @@ -28,10 +28,10 @@ public partial class Recipient : public string EmailAddress { get => this._emailAddress; } /// Internal Acessors for DisplayName - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipientInternal.DisplayName { get => this._displayName; set { {_displayName = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipientInternal.DisplayName { get => this._displayName; set { {_displayName = value;} } } /// Internal Acessors for EmailAddress - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipientInternal.EmailAddress { get => this._emailAddress; set { {_emailAddress = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipientInternal.EmailAddress { get => this._emailAddress; set { {_emailAddress = value;} } } /// Backing field for property. private string _principalId; @@ -54,6 +54,9 @@ public partial interface IRecipient : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Display Name", SerializedName = @"displayName", PossibleTypes = new [] { typeof(string) })] @@ -62,6 +65,9 @@ public partial interface IRecipient : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Email Address", SerializedName = @"emailAddress", PossibleTypes = new [] { typeof(string) })] @@ -70,6 +76,9 @@ public partial interface IRecipient : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Principal ID", SerializedName = @"principalId", PossibleTypes = new [] { typeof(string) })] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Recipient.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Recipient.json.cs similarity index 89% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Recipient.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/Recipient.json.cs index 53a3c858c895..9fe681c8f9e9 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Recipient.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Recipient.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class Recipient partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class Recipient /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class Recipient /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class Recipient partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new Recipient(json) : null; } @@ -75,9 +77,9 @@ internal Recipient(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.J { return; } - {_principalId = If( json?.PropertyT("principalId"), out var __jsonPrincipalId) ? (string)__jsonPrincipalId : (string)PrincipalId;} - {_emailAddress = If( json?.PropertyT("emailAddress"), out var __jsonEmailAddress) ? (string)__jsonEmailAddress : (string)EmailAddress;} - {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)DisplayName;} + {_principalId = If( json?.PropertyT("principalId"), out var __jsonPrincipalId) ? (string)__jsonPrincipalId : (string)_principalId;} + {_emailAddress = If( json?.PropertyT("emailAddress"), out var __jsonEmailAddress) ? (string)__jsonEmailAddress : (string)_emailAddress;} + {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)_displayName;} AfterFromJson(json); } @@ -101,11 +103,11 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs return container; } AddIf( null != (((object)this._principalId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._principalId.ToString()) : null, "principalId" ,container.Add ); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._emailAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._emailAddress.ToString()) : null, "emailAddress" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._displayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._displayName.ToString()) : null, "displayName" ,container.Add ); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalProperties.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalProperties.PowerShell.cs similarity index 58% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalProperties.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalProperties.PowerShell.cs index e5a9e58c2fbc..d7dc9052283d 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalProperties.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalProperties.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class RequestApprovalProperties /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class RequestApprovalProperties /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,29 +55,35 @@ public partial class RequestApprovalProperties partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new RequestApprovalProperties(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new RequestApprovalProperties(content); } @@ -84,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,33 +111,33 @@ internal RequestApprovalProperties(global::System.Collections.IDictionary conten // actually deserialize if (content.Contains("OfferId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).OfferId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).OfferId, global::System.Convert.ToString); } if (content.Contains("OfferDisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).OfferDisplayName = (string) content.GetValueForProperty("OfferDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).OfferDisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).OfferDisplayName = (string) content.GetValueForProperty("OfferDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).OfferDisplayName, global::System.Convert.ToString); } if (content.Contains("PublisherId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).PublisherId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).PublisherId, global::System.Convert.ToString); } if (content.Contains("PlansDetail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).PlansDetail = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails[]) content.GetValueForProperty("PlansDetail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).PlansDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).PlansDetail = (System.Collections.Generic.List) content.GetValueForProperty("PlansDetail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).PlansDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanDetailsTypeConverter.ConvertFrom)); } if (content.Contains("IsClosed")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).IsClosed = (bool?) content.GetValueForProperty("IsClosed",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).IsClosed, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).IsClosed = (bool?) content.GetValueForProperty("IsClosed",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).IsClosed, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("MessageCode")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -144,27 +152,27 @@ internal RequestApprovalProperties(global::System.Management.Automation.PSObject // actually deserialize if (content.Contains("OfferId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).OfferId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).OfferId, global::System.Convert.ToString); } if (content.Contains("OfferDisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).OfferDisplayName = (string) content.GetValueForProperty("OfferDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).OfferDisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).OfferDisplayName = (string) content.GetValueForProperty("OfferDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).OfferDisplayName, global::System.Convert.ToString); } if (content.Contains("PublisherId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).PublisherId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).PublisherId, global::System.Convert.ToString); } if (content.Contains("PlansDetail")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).PlansDetail = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails[]) content.GetValueForProperty("PlansDetail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).PlansDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).PlansDetail = (System.Collections.Generic.List) content.GetValueForProperty("PlansDetail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).PlansDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanDetailsTypeConverter.ConvertFrom)); } if (content.Contains("IsClosed")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).IsClosed = (bool?) content.GetValueForProperty("IsClosed",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).IsClosed, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).IsClosed = (bool?) content.GetValueForProperty("IsClosed",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).IsClosed, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("MessageCode")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); } AfterDeserializePSObject(content); } @@ -173,6 +181,18 @@ internal RequestApprovalProperties(global::System.Management.Automation.PSObject /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Approval request resource properties [System.ComponentModel.TypeConverter(typeof(RequestApprovalPropertiesTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalProperties.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalProperties.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalProperties.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalProperties.TypeConverter.cs index 5f1b3cc45f30..60deac8681d6 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalProperties.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalProperties.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class RequestApprovalPropertiesTypeConverter : global::System.Man { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalProperties.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalProperties.cs similarity index 80% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalProperties.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalProperties.cs index b83c4b6e6cc2..ce23e28bf261 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalProperties.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalProperties.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Approval request resource properties public partial class RequestApprovalProperties : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalProperties, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalProperties, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal { /// Backing field for property. @@ -28,10 +28,10 @@ public partial class RequestApprovalProperties : public long? MessageCode { get => this._messageCode; set => this._messageCode = value; } /// Internal Acessors for IsClosed - bool? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal.IsClosed { get => this._isClosed; set { {_isClosed = value;} } } + bool? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal.IsClosed { get => this._isClosed; set { {_isClosed = value;} } } /// Internal Acessors for OfferDisplayName - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal.OfferDisplayName { get => this._offerDisplayName; set { {_offerDisplayName = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal.OfferDisplayName { get => this._offerDisplayName; set { {_offerDisplayName = value;} } } /// Backing field for property. private string _offerDisplayName; @@ -48,11 +48,11 @@ public partial class RequestApprovalProperties : public string OfferId { get => this._offerId; set => this._offerId = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails[] _plansDetail; + private System.Collections.Generic.List _plansDetail; /// Gets or sets the plans details [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails[] PlansDetail { get => this._plansDetail; set => this._plansDetail = value; } + public System.Collections.Generic.List PlansDetail { get => this._plansDetail; set => this._plansDetail = value; } /// Backing field for property. private string _publisherId; @@ -75,6 +75,9 @@ public partial interface IRequestApprovalProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets a value indicating whether the request is closed", SerializedName = @"isClosed", PossibleTypes = new [] { typeof(bool) })] @@ -83,6 +86,9 @@ public partial interface IRequestApprovalProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the request approval message code", SerializedName = @"messageCode", PossibleTypes = new [] { typeof(long) })] @@ -91,6 +97,9 @@ public partial interface IRequestApprovalProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets offer display name", SerializedName = @"offerDisplayName", PossibleTypes = new [] { typeof(string) })] @@ -99,6 +108,9 @@ public partial interface IRequestApprovalProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets unique offer id.", SerializedName = @"offerId", PossibleTypes = new [] { typeof(string) })] @@ -107,14 +119,20 @@ public partial interface IRequestApprovalProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the plans details", SerializedName = @"plansDetails", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails[] PlansDetail { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetails) })] + System.Collections.Generic.List PlansDetail { get; set; } /// The offer's publisher id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The offer's publisher id", SerializedName = @"publisherId", PossibleTypes = new [] { typeof(string) })] @@ -134,7 +152,7 @@ internal partial interface IRequestApprovalPropertiesInternal /// Gets or sets unique offer id. string OfferId { get; set; } /// Gets or sets the plans details - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails[] PlansDetail { get; set; } + System.Collections.Generic.List PlansDetail { get; set; } /// The offer's publisher id string PublisherId { get; set; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalProperties.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalProperties.json.cs similarity index 85% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalProperties.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalProperties.json.cs index 241ae59cc70f..4d17618828f7 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalProperties.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalProperties.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class RequestApprovalProperties partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class RequestApprovalProperties /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class RequestApprovalProperties /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class RequestApprovalProperties partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new RequestApprovalProperties(json) : null; } @@ -75,12 +77,12 @@ internal RequestApprovalProperties(Microsoft.Azure.PowerShell.Cmdlets.Marketplac { return; } - {_offerId = If( json?.PropertyT("offerId"), out var __jsonOfferId) ? (string)__jsonOfferId : (string)OfferId;} - {_offerDisplayName = If( json?.PropertyT("offerDisplayName"), out var __jsonOfferDisplayName) ? (string)__jsonOfferDisplayName : (string)OfferDisplayName;} - {_publisherId = If( json?.PropertyT("publisherId"), out var __jsonPublisherId) ? (string)__jsonPublisherId : (string)PublisherId;} - {_plansDetail = If( json?.PropertyT("plansDetails"), out var __jsonPlansDetails) ? If( __jsonPlansDetails as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanDetails.FromJson(__u) )) ))() : null : PlansDetail;} - {_isClosed = If( json?.PropertyT("isClosed"), out var __jsonIsClosed) ? (bool?)__jsonIsClosed : IsClosed;} - {_messageCode = If( json?.PropertyT("messageCode"), out var __jsonMessageCode) ? (long?)__jsonMessageCode : MessageCode;} + {_offerId = If( json?.PropertyT("offerId"), out var __jsonOfferId) ? (string)__jsonOfferId : (string)_offerId;} + {_offerDisplayName = If( json?.PropertyT("offerDisplayName"), out var __jsonOfferDisplayName) ? (string)__jsonOfferDisplayName : (string)_offerDisplayName;} + {_publisherId = If( json?.PropertyT("publisherId"), out var __jsonPublisherId) ? (string)__jsonPublisherId : (string)_publisherId;} + {_plansDetail = If( json?.PropertyT("plansDetails"), out var __jsonPlansDetails) ? If( __jsonPlansDetails as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanDetails.FromJson(__u) )) ))() : null : _plansDetail;} + {_isClosed = If( json?.PropertyT("isClosed"), out var __jsonIsClosed) ? (bool?)__jsonIsClosed : _isClosed;} + {_messageCode = If( json?.PropertyT("messageCode"), out var __jsonMessageCode) ? (long?)__jsonMessageCode : _messageCode;} AfterFromJson(json); } @@ -104,7 +106,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs return container; } AddIf( null != (((object)this._offerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._offerId.ToString()) : null, "offerId" ,container.Add ); - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._offerDisplayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._offerDisplayName.ToString()) : null, "offerDisplayName" ,container.Add ); } @@ -118,7 +120,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs } container.Add("plansDetails",__w); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != this._isClosed ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonBoolean((bool)this._isClosed) : null, "isClosed" ,container.Add ); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalResource.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalResource.PowerShell.cs new file mode 100644 index 000000000000..a9c816e8e328 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalResource.PowerShell.cs @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// Request approval resource. + [System.ComponentModel.TypeConverter(typeof(RequestApprovalResourceTypeConverter))] + public partial class RequestApprovalResource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RequestApprovalResource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RequestApprovalResource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RequestApprovalResource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("OfferId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).OfferId, global::System.Convert.ToString); + } + if (content.Contains("OfferDisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).OfferDisplayName = (string) content.GetValueForProperty("OfferDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).OfferDisplayName, global::System.Convert.ToString); + } + if (content.Contains("PublisherId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).PublisherId, global::System.Convert.ToString); + } + if (content.Contains("PlansDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).PlansDetail = (System.Collections.Generic.List) content.GetValueForProperty("PlansDetail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).PlansDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("IsClosed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).IsClosed = (bool?) content.GetValueForProperty("IsClosed",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).IsClosed, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MessageCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RequestApprovalResource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SystemDataTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("OfferId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).OfferId, global::System.Convert.ToString); + } + if (content.Contains("OfferDisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).OfferDisplayName = (string) content.GetValueForProperty("OfferDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).OfferDisplayName, global::System.Convert.ToString); + } + if (content.Contains("PublisherId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).PublisherId, global::System.Convert.ToString); + } + if (content.Contains("PlansDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).PlansDetail = (System.Collections.Generic.List) content.GetValueForProperty("PlansDetail",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).PlansDetail, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("IsClosed")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).IsClosed = (bool?) content.GetValueForProperty("IsClosed",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).IsClosed, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MessageCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Request approval resource. + [System.ComponentModel.TypeConverter(typeof(RequestApprovalResourceTypeConverter))] + public partial interface IRequestApprovalResource + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalResource.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalResource.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalResource.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalResource.TypeConverter.cs index a619bbbd2160..fb6e1b608a8b 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalResource.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalResource.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class RequestApprovalResourceTypeConverter : global::System.Manag { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResource ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResource).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalResource.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalResource.cs similarity index 56% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalResource.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalResource.cs index ccb775adc214..97bd50a6c12f 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalResource.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalResource.cs @@ -3,113 +3,116 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Request approval resource. public partial class RequestApprovalResource : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResource, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IValidates { /// - /// Backing field for Inherited model + /// Backing field for Inherited model /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Resource(); + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Resource(); /// The resource ID. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Id; } + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Id; } /// Gets a value indicating whether the request is closed [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public bool? IsClosed { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)Property).IsClosed; } + public bool? IsClosed { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)Property).IsClosed; } /// Gets or sets the request approval message code [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public long? MessageCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)Property).MessageCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)Property).MessageCode = value ?? default(long); } + public long? MessageCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)Property).MessageCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)Property).MessageCode = value ?? default(long); } /// Internal Acessors for IsClosed - bool? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal.IsClosed { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)Property).IsClosed; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)Property).IsClosed = value; } + bool? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal.IsClosed { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)Property).IsClosed; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)Property).IsClosed = value; } /// Internal Acessors for OfferDisplayName - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal.OfferDisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)Property).OfferDisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)Property).OfferDisplayName = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal.OfferDisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)Property).OfferDisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)Property).OfferDisplayName = value; } /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalProperties Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResourceInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalProperties()); set { {_property = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalProperties Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResourceInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalProperties()); set { {_property = value;} } } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Id = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Id = value; } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Name = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Name = value; } /// Internal Acessors for SystemData - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemData = value; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemData; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemData = value; } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Type = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Type = value; } /// The name of the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Name; } + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Name; } /// Gets offer display name [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string OfferDisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)Property).OfferDisplayName; } + public string OfferDisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)Property).OfferDisplayName; } /// Gets or sets unique offer id. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string OfferId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)Property).OfferId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)Property).OfferId = value ?? null; } + public string OfferId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)Property).OfferId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)Property).OfferId = value ?? null; } /// Gets or sets the plans details [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails[] PlansDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)Property).PlansDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)Property).PlansDetail = value ?? null /* arrayOf */; } + public System.Collections.Generic.List PlansDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)Property).PlansDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)Property).PlansDetail = value ?? null /* arrayOf */; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalProperties _property; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalProperties _property; /// The privateStore approval request data structure. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalProperties()); set => this._property = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalProperties()); set => this._property = value; } /// The offer's publisher id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string PublisherId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)Property).PublisherId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalPropertiesInternal)Property).PublisherId = value ?? null; } + public string PublisherId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)Property).PublisherId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalPropertiesInternal)Property).PublisherId = value ?? null; } + + /// Gets the resource group name + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string ResourceGroupName { get => (new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Success ? new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(this.Id).Groups["resourceGroupName"].Value : null); } /// Metadata pertaining to creation and last modification of the resource [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemData; } + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData SystemData { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemData; } /// The timestamp of resource creation (UTC) [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedAt = value ?? default(global::System.DateTime); } /// The identity that created the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedBy = value ?? null; } + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedBy = value ?? null; } /// The type of identity that created the resource [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataCreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType)""); } + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataCreatedByType = value ?? null; } /// The timestamp of resource last modification (UTC) [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedAt = value ?? default(global::System.DateTime); } /// The identity that last modified the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedBy = value ?? null; } + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedBy = value ?? null; } /// The type of identity that last modified the resource [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).SystemDataLastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType)""); } + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).SystemDataLastModifiedByType = value ?? null; } /// The type of the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inherited)] - public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)__resource).Type; } + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)__resource).Type; } /// Creates an new instance. public RequestApprovalResource() @@ -121,7 +124,7 @@ public RequestApprovalResource() /// an instance that will receive validation /// events. /// - /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// A that will be complete when validation is completed. /// public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener eventListener) { @@ -132,12 +135,15 @@ public RequestApprovalResource() /// Request approval resource. public partial interface IRequestApprovalResource : Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResource + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResource { /// Gets a value indicating whether the request is closed [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets a value indicating whether the request is closed", SerializedName = @"isClosed", PossibleTypes = new [] { typeof(bool) })] @@ -146,6 +152,9 @@ public partial interface IRequestApprovalResource : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the request approval message code", SerializedName = @"messageCode", PossibleTypes = new [] { typeof(long) })] @@ -154,6 +163,9 @@ public partial interface IRequestApprovalResource : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets offer display name", SerializedName = @"offerDisplayName", PossibleTypes = new [] { typeof(string) })] @@ -162,6 +174,9 @@ public partial interface IRequestApprovalResource : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets unique offer id.", SerializedName = @"offerId", PossibleTypes = new [] { typeof(string) })] @@ -170,14 +185,20 @@ public partial interface IRequestApprovalResource : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the plans details", SerializedName = @"plansDetails", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails[] PlansDetail { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanDetails) })] + System.Collections.Generic.List PlansDetail { get; set; } /// The offer's publisher id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The offer's publisher id", SerializedName = @"publisherId", PossibleTypes = new [] { typeof(string) })] @@ -186,7 +207,7 @@ public partial interface IRequestApprovalResource : } /// Request approval resource. internal partial interface IRequestApprovalResourceInternal : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal { /// Gets a value indicating whether the request is closed bool? IsClosed { get; set; } @@ -197,9 +218,9 @@ internal partial interface IRequestApprovalResourceInternal : /// Gets or sets unique offer id. string OfferId { get; set; } /// Gets or sets the plans details - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanDetails[] PlansDetail { get; set; } + System.Collections.Generic.List PlansDetail { get; set; } /// The privateStore approval request data structure. - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalProperties Property { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalProperties Property { get; set; } /// The offer's publisher id string PublisherId { get; set; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalResource.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalResource.json.cs similarity index 88% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalResource.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalResource.json.cs index 7a9a8e5fc8db..d3dec780781b 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalResource.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalResource.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class RequestApprovalResource partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class RequestApprovalResource /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class RequestApprovalResource /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class RequestApprovalResource partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResource. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResource. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new RequestApprovalResource(json) : null; } @@ -75,8 +77,8 @@ internal RequestApprovalResource(Microsoft.Azure.PowerShell.Cmdlets.Marketplace. { return; } - __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Resource(json); - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalProperties.FromJson(__jsonProperties) : Property;} + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalProperties.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsDetails.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsDetails.PowerShell.cs similarity index 59% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsDetails.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsDetails.PowerShell.cs index 82021ce9dff1..837b6fa0a19a 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsDetails.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsDetails.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class RequestApprovalsDetails /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class RequestApprovalsDetails /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,29 +55,35 @@ public partial class RequestApprovalsDetails partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new RequestApprovalsDetails(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new RequestApprovalsDetails(content); } @@ -84,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -103,33 +111,33 @@ internal RequestApprovalsDetails(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("OfferId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).OfferId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).OfferId, global::System.Convert.ToString); } if (content.Contains("DisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).DisplayName, global::System.Convert.ToString); } if (content.Contains("PublisherId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).PublisherId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).PublisherId, global::System.Convert.ToString); } if (content.Contains("MessageCode")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); } if (content.Contains("Icon")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).Icon = (string) content.GetValueForProperty("Icon",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).Icon, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).Icon = (string) content.GetValueForProperty("Icon",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).Icon, global::System.Convert.ToString); } if (content.Contains("Plan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).Plan = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails[]) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).Plan, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanNotificationDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).Plan = (System.Collections.Generic.List) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).Plan, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanNotificationDetailsTypeConverter.ConvertFrom)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -144,27 +152,27 @@ internal RequestApprovalsDetails(global::System.Management.Automation.PSObject c // actually deserialize if (content.Contains("OfferId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).OfferId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).OfferId, global::System.Convert.ToString); } if (content.Contains("DisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).DisplayName, global::System.Convert.ToString); } if (content.Contains("PublisherId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).PublisherId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).PublisherId, global::System.Convert.ToString); } if (content.Contains("MessageCode")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); } if (content.Contains("Icon")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).Icon = (string) content.GetValueForProperty("Icon",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).Icon, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).Icon = (string) content.GetValueForProperty("Icon",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).Icon, global::System.Convert.ToString); } if (content.Contains("Plan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).Plan = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails[]) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal)this).Plan, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanNotificationDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).Plan = (System.Collections.Generic.List) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal)this).Plan, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanNotificationDetailsTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } @@ -173,6 +181,18 @@ internal RequestApprovalsDetails(global::System.Management.Automation.PSObject c /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Request approvals details [System.ComponentModel.TypeConverter(typeof(RequestApprovalsDetailsTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsDetails.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsDetails.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsDetails.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsDetails.TypeConverter.cs index 4193ce9f0bd6..2074be23fe6a 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsDetails.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsDetails.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class RequestApprovalsDetailsTypeConverter : global::System.Manag { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetails ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetails ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetails).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetails).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsDetails.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsDetails.cs similarity index 82% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsDetails.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsDetails.cs index 29a41600fe17..0150e9b6324c 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsDetails.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsDetails.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Request approvals details public partial class RequestApprovalsDetails : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetails, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetailsInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetails, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetailsInternal { /// Backing field for property. @@ -42,11 +42,11 @@ public partial class RequestApprovalsDetails : public string OfferId { get => this._offerId; set => this._offerId = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails[] _plan; + private System.Collections.Generic.List _plan; /// Gets or sets removed plans notifications [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails[] Plan { get => this._plan; set => this._plan = value; } + public System.Collections.Generic.List Plan { get => this._plan; set => this._plan = value; } /// Backing field for property. private string _publisherId; @@ -69,6 +69,9 @@ public partial interface IRequestApprovalsDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets offer display name", SerializedName = @"displayName", PossibleTypes = new [] { typeof(string) })] @@ -77,6 +80,9 @@ public partial interface IRequestApprovalsDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the icon url", SerializedName = @"icon", PossibleTypes = new [] { typeof(string) })] @@ -85,6 +91,9 @@ public partial interface IRequestApprovalsDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the notification message id", SerializedName = @"messageCode", PossibleTypes = new [] { typeof(long) })] @@ -93,6 +102,9 @@ public partial interface IRequestApprovalsDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets offer id", SerializedName = @"offerId", PossibleTypes = new [] { typeof(string) })] @@ -101,14 +113,20 @@ public partial interface IRequestApprovalsDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets removed plans notifications", SerializedName = @"plans", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails[] Plan { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetails) })] + System.Collections.Generic.List Plan { get; set; } /// Gets or sets publisher id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets publisher id", SerializedName = @"publisherId", PossibleTypes = new [] { typeof(string) })] @@ -128,7 +146,7 @@ internal partial interface IRequestApprovalsDetailsInternal /// Gets offer id string OfferId { get; set; } /// Gets or sets removed plans notifications - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails[] Plan { get; set; } + System.Collections.Generic.List Plan { get; set; } /// Gets or sets publisher id string PublisherId { get; set; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsDetails.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsDetails.json.cs similarity index 86% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsDetails.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsDetails.json.cs index e9069de39590..8d098bbd2b7d 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsDetails.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsDetails.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class RequestApprovalsDetails partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class RequestApprovalsDetails /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class RequestApprovalsDetails /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class RequestApprovalsDetails partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetails. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetails. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetails. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetails. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new RequestApprovalsDetails(json) : null; } @@ -75,12 +77,12 @@ internal RequestApprovalsDetails(Microsoft.Azure.PowerShell.Cmdlets.Marketplace. { return; } - {_offerId = If( json?.PropertyT("offerId"), out var __jsonOfferId) ? (string)__jsonOfferId : (string)OfferId;} - {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)DisplayName;} - {_publisherId = If( json?.PropertyT("publisherId"), out var __jsonPublisherId) ? (string)__jsonPublisherId : (string)PublisherId;} - {_messageCode = If( json?.PropertyT("messageCode"), out var __jsonMessageCode) ? (long?)__jsonMessageCode : MessageCode;} - {_icon = If( json?.PropertyT("icon"), out var __jsonIcon) ? (string)__jsonIcon : (string)Icon;} - {_plan = If( json?.PropertyT("plans"), out var __jsonPlans) ? If( __jsonPlans as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanNotificationDetails.FromJson(__u) )) ))() : null : Plan;} + {_offerId = If( json?.PropertyT("offerId"), out var __jsonOfferId) ? (string)__jsonOfferId : (string)_offerId;} + {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)_displayName;} + {_publisherId = If( json?.PropertyT("publisherId"), out var __jsonPublisherId) ? (string)__jsonPublisherId : (string)_publisherId;} + {_messageCode = If( json?.PropertyT("messageCode"), out var __jsonMessageCode) ? (long?)__jsonMessageCode : _messageCode;} + {_icon = If( json?.PropertyT("icon"), out var __jsonIcon) ? (string)__jsonIcon : (string)_icon;} + {_plan = If( json?.PropertyT("plans"), out var __jsonPlans) ? If( __jsonPlans as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanNotificationDetails.FromJson(__u) )) ))() : null : _plan;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsList.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsList.PowerShell.cs similarity index 66% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsList.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsList.PowerShell.cs index 3e8fd7c33337..b34ba3e50781 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsList.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsList.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class RequestApprovalsList /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class RequestApprovalsList /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,27 +55,35 @@ public partial class RequestApprovalsList partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsList DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsList DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new RequestApprovalsList(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new RequestApprovalsList(content); } @@ -82,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -101,17 +111,17 @@ internal RequestApprovalsList(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsListInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsListInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalResourceTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalResourceTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsListInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsListInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -126,11 +136,11 @@ internal RequestApprovalsList(global::System.Management.Automation.PSObject cont // actually deserialize if (content.Contains("Value")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsListInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsListInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalResourceTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsListInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsListInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalResourceTypeConverter.ConvertFrom)); } if (content.Contains("NextLink")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsListInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsListInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsListInternal)this).NextLink, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -139,6 +149,18 @@ internal RequestApprovalsList(global::System.Management.Automation.PSObject cont /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// List of admin request approval resources [System.ComponentModel.TypeConverter(typeof(RequestApprovalsListTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsList.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsList.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsList.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsList.TypeConverter.cs index 2ad58914f5f6..3c4a7d8c809b 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsList.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsList.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class RequestApprovalsListTypeConverter : global::System.Manageme { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsList ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsList ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsList).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsList).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsList.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsList.cs similarity index 69% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsList.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsList.cs index 1f7e9532693e..4c2df1fef68b 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsList.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsList.cs @@ -3,18 +3,18 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// List of admin request approval resources public partial class RequestApprovalsList : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsList, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsListInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsList, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsListInternal { /// Internal Acessors for NextLink - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsListInternal.NextLink { get => this._nextLink; set { {_nextLink = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsListInternal.NextLink { get => this._nextLink; set { {_nextLink = value;} } } /// Backing field for property. private string _nextLink; @@ -24,10 +24,10 @@ public partial class RequestApprovalsList : public string NextLink { get => this._nextLink; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource[] _value; + private System.Collections.Generic.List _value; [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource[] Value { get => this._value; set => this._value = value; } + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } /// Creates an new instance. public RequestApprovalsList() @@ -43,6 +43,9 @@ public partial interface IRequestApprovalsList : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"URL to get the next set of notifications list results if there are any.", SerializedName = @"nextLink", PossibleTypes = new [] { typeof(string) })] @@ -51,10 +54,13 @@ public partial interface IRequestApprovalsList : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"", SerializedName = @"value", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource[] Value { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResource) })] + System.Collections.Generic.List Value { get; set; } } /// List of admin request approval resources @@ -64,7 +70,7 @@ internal partial interface IRequestApprovalsListInternal /// URL to get the next set of notifications list results if there are any. string NextLink { get; set; } - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource[] Value { get; set; } + System.Collections.Generic.List Value { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsList.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsList.json.cs similarity index 84% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsList.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsList.json.cs index 2fcfbd96a746..869c41f00c91 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestApprovalsList.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestApprovalsList.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class RequestApprovalsList partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class RequestApprovalsList /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class RequestApprovalsList /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class RequestApprovalsList partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsList. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsList. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsList. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsList. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalsList FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalsList FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new RequestApprovalsList(json) : null; } @@ -75,8 +77,8 @@ internal RequestApprovalsList(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Run { return; } - {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestApprovalResource) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.RequestApprovalResource.FromJson(__u) )) ))() : null : Value;} - {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestApprovalResource) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RequestApprovalResource.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} AfterFromJson(json); } @@ -108,7 +110,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs } container.Add("value",__w); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestDetails.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestDetails.PowerShell.cs similarity index 67% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestDetails.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestDetails.PowerShell.cs index 55c96f29f8f2..5ef0a55799e3 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestDetails.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestDetails.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class RequestDetails /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class RequestDetails /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,27 +55,35 @@ public partial class RequestDetails partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new RequestDetails(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new RequestDetails(content); } @@ -82,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -101,21 +111,21 @@ internal RequestDetails(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("PublisherId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetailsInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetailsInternal)this).PublisherId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetailsInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetailsInternal)this).PublisherId, global::System.Convert.ToString); } if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetailsInternal)this).PlanId = (string[]) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetailsInternal)this).PlanId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetailsInternal)this).PlanId = (System.Collections.Generic.List) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetailsInternal)this).PlanId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("SubscriptionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetailsInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetailsInternal)this).SubscriptionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetailsInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetailsInternal)this).SubscriptionId, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -130,15 +140,15 @@ internal RequestDetails(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("PublisherId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetailsInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetailsInternal)this).PublisherId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetailsInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetailsInternal)this).PublisherId, global::System.Convert.ToString); } if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetailsInternal)this).PlanId = (string[]) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetailsInternal)this).PlanId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetailsInternal)this).PlanId = (System.Collections.Generic.List) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetailsInternal)this).PlanId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("SubscriptionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetailsInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetailsInternal)this).SubscriptionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetailsInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetailsInternal)this).SubscriptionId, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -147,6 +157,18 @@ internal RequestDetails(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Request details needed to get the plans statuses [System.ComponentModel.TypeConverter(typeof(RequestDetailsTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestDetails.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestDetails.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestDetails.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestDetails.TypeConverter.cs index 4c9e92f8fc26..078e4be95161 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestDetails.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestDetails.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class RequestDetailsTypeConverter : global::System.Management.Aut { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetails ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetails ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetails).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetails).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestDetails.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestDetails.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestDetails.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestDetails.cs index 28465865522c..cbb4a685df83 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestDetails.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestDetails.cs @@ -3,22 +3,22 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Request details needed to get the plans statuses public partial class RequestDetails : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetails, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetailsInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetails, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetailsInternal { /// Backing field for property. - private string[] _planId; + private System.Collections.Generic.List _planId; /// Current plans list [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public string[] PlanId { get => this._planId; set => this._planId = value; } + public System.Collections.Generic.List PlanId { get => this._planId; set => this._planId = value; } /// Backing field for property. private string _publisherId; @@ -48,14 +48,20 @@ public partial interface IRequestDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Current plans list", SerializedName = @"planIds", PossibleTypes = new [] { typeof(string) })] - string[] PlanId { get; set; } + System.Collections.Generic.List PlanId { get; set; } /// The offer's publisher id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The offer's publisher id", SerializedName = @"publisherId", PossibleTypes = new [] { typeof(string) })] @@ -64,6 +70,9 @@ public partial interface IRequestDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the subscription id", SerializedName = @"subscriptionId", PossibleTypes = new [] { typeof(string) })] @@ -75,7 +84,7 @@ internal partial interface IRequestDetailsInternal { /// Current plans list - string[] PlanId { get; set; } + System.Collections.Generic.List PlanId { get; set; } /// The offer's publisher id string PublisherId { get; set; } /// Gets or sets the subscription id diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestDetails.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestDetails.json.cs similarity index 87% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestDetails.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestDetails.json.cs index 2441a50c6418..2022c5926c2d 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/RequestDetails.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RequestDetails.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class RequestDetails partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class RequestDetails /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class RequestDetails /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class RequestDetails partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetails. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetails. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetails. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetails. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRequestDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRequestDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new RequestDetails(json) : null; } @@ -75,9 +77,9 @@ internal RequestDetails(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.J { return; } - {_publisherId = If( json?.PropertyT("publisherId"), out var __jsonPublisherId) ? (string)__jsonPublisherId : (string)PublisherId;} - {_planId = If( json?.PropertyT("planIds"), out var __jsonPlanIds) ? If( __jsonPlanIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : PlanId;} - {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} + {_publisherId = If( json?.PropertyT("publisherId"), out var __jsonPublisherId) ? (string)__jsonPublisherId : (string)_publisherId;} + {_planId = If( json?.PropertyT("planIds"), out var __jsonPlanIds) ? If( __jsonPlanIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _planId;} + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)_subscriptionId;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Resource.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Resource.PowerShell.cs similarity index 54% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Resource.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/Resource.PowerShell.cs index b514ec9ef42b..7ecb330a64e1 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Resource.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Resource.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class Resource /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class Resource /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,27 +55,35 @@ public partial class Resource partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResource DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new Resource(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new Resource(content); } @@ -82,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -101,49 +111,49 @@ internal Resource(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("SystemData")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SystemDataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SystemDataTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("SystemDataCreatedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -158,43 +168,43 @@ internal Resource(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("SystemData")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SystemDataTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SystemDataTypeConverter.ConvertFrom); } if (content.Contains("Id")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("Type")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).Type, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataCreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("SystemDataCreatedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataCreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); } if (content.Contains("SystemDataLastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } AfterDeserializePSObject(content); } @@ -203,6 +213,18 @@ internal Resource(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// An Azure resource. [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Resource.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Resource.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Resource.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/Resource.TypeConverter.cs index ddbdf4c0a0c8..90b81cfeb8a6 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Resource.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Resource.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,19 @@ public partial class ResourceTypeConverter : global::System.Management.Automatio { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +74,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +99,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResource ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResource ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResource).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResource).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Resource.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Resource.cs similarity index 66% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Resource.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/Resource.cs index 00c32880b63d..e7232e06afc4 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Resource.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Resource.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// An Azure resource. public partial class Resource : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResource, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResource, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal { /// Backing field for property. @@ -21,16 +21,16 @@ public partial class Resource : public string Id { get => this._id; } /// Internal Acessors for Id - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.Id { get => this._id; set { {_id = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.Id { get => this._id; set { {_id = value;} } } /// Internal Acessors for Name - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.Name { get => this._name; set { {_name = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.Name { get => this._name; set { {_name = value;} } } /// Internal Acessors for SystemData - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SystemData()); set { {_systemData = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SystemData()); set { {_systemData = value;} } } /// Internal Acessors for Type - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResourceInternal.Type { get => this._type; set { {_type = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResourceInternal.Type { get => this._type; set { {_type = value;} } } /// Backing field for property. private string _name; @@ -40,35 +40,35 @@ public partial class Resource : public string Name { get => this._name; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData _systemData; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData _systemData; /// Metadata pertaining to creation and last modification of the resource [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SystemData()); } + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SystemData()); } /// The timestamp of resource creation (UTC) [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } /// The identity that created the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)SystemData).CreatedBy = value ?? null; } + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)SystemData).CreatedBy = value ?? null; } /// The type of identity that created the resource [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)SystemData).CreatedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType)""); } + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)SystemData).CreatedByType = value ?? null; } /// The timestamp of resource last modification (UTC) [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } /// The identity that last modified the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)SystemData).LastModifiedBy = value ?? null; } + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)SystemData).LastModifiedBy = value ?? null; } /// The type of identity that last modified the resource [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)SystemData).LastModifiedByType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType)""); } + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)SystemData).LastModifiedByType = value ?? null; } /// Backing field for property. private string _type; @@ -91,6 +91,9 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The resource ID.", SerializedName = @"id", PossibleTypes = new [] { typeof(string) })] @@ -99,6 +102,9 @@ public partial interface IResource : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The name of the resource.", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] @@ -106,55 +112,78 @@ public partial interface IResource : /// The timestamp of resource creation (UTC) [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The timestamp of resource creation (UTC)", SerializedName = @"createdAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] - global::System.DateTime? SystemDataCreatedAt { get; set; } + global::System.DateTime? SystemDataCreatedAt { get; } /// The identity that created the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The identity that created the resource.", SerializedName = @"createdBy", PossibleTypes = new [] { typeof(string) })] - string SystemDataCreatedBy { get; set; } + string SystemDataCreatedBy { get; } /// The type of identity that created the resource [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The type of identity that created the resource", SerializedName = @"createdByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? SystemDataCreatedByType { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; } /// The timestamp of resource last modification (UTC) [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The timestamp of resource last modification (UTC)", SerializedName = @"lastModifiedAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] - global::System.DateTime? SystemDataLastModifiedAt { get; set; } + global::System.DateTime? SystemDataLastModifiedAt { get; } /// The identity that last modified the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The identity that last modified the resource.", SerializedName = @"lastModifiedBy", PossibleTypes = new [] { typeof(string) })] - string SystemDataLastModifiedBy { get; set; } + string SystemDataLastModifiedBy { get; } /// The type of identity that last modified the resource [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, - ReadOnly = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The type of identity that last modified the resource", SerializedName = @"lastModifiedByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? SystemDataLastModifiedByType { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; } /// The type of the resource. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"The type of the resource.", SerializedName = @"type", PossibleTypes = new [] { typeof(string) })] @@ -170,19 +199,21 @@ internal partial interface IResourceInternal /// The name of the resource. string Name { get; set; } /// Metadata pertaining to creation and last modification of the resource - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData SystemData { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData SystemData { get; set; } /// The timestamp of resource creation (UTC) global::System.DateTime? SystemDataCreatedAt { get; set; } /// The identity that created the resource. string SystemDataCreatedBy { get; set; } /// The type of identity that created the resource - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? SystemDataCreatedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataCreatedByType { get; set; } /// The timestamp of resource last modification (UTC) global::System.DateTime? SystemDataLastModifiedAt { get; set; } /// The identity that last modified the resource. string SystemDataLastModifiedBy { get; set; } /// The type of identity that last modified the resource - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? SystemDataLastModifiedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string SystemDataLastModifiedByType { get; set; } /// The type of the resource. string Type { get; set; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Resource.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Resource.json.cs similarity index 85% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Resource.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/Resource.json.cs index 56f6eb52e95a..af3c1f2c9662 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/Resource.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Resource.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class Resource partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class Resource /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class Resource /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,11 @@ public partial class Resource partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResource. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResource. /// /// a to deserialize from. - /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResource. - /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResource. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new Resource(json) : null; } @@ -75,10 +75,10 @@ internal Resource(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.Js { return; } - {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SystemData.FromJson(__jsonSystemData) : SystemData;} - {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} - {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} - {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SystemData.FromJson(__jsonSystemData) : _systemData;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} AfterFromJson(json); } @@ -101,19 +101,19 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Rule.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Rule.PowerShell.cs new file mode 100644 index 000000000000..feea63f797e6 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Rule.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(RuleTypeConverter))] + public partial class Rule + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRule DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Rule(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRule DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Rule(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRule FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Rule(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Rule(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + [System.ComponentModel.TypeConverter(typeof(RuleTypeConverter))] + public partial interface IRule + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Rule.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Rule.TypeConverter.cs new file mode 100644 index 000000000000..569f9f89207c --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Rule.TypeConverter.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RuleTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRule ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRule).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Rule.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Rule.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Rule.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Rule.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Rule.cs new file mode 100644 index 000000000000..016a4cce0e34 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Rule.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + public partial class Rule : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRule, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleInternal + { + + /// Backing field for property. + private string _type; + + /// Rule type + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public Rule() + { + + } + } + public partial interface IRule : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + /// Rule type + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Rule type", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("PrivateProducts", "TermsAndCondition")] + string Type { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"", + SerializedName = @"value", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List Value { get; set; } + + } + internal partial interface IRuleInternal + + { + /// Rule type + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("PrivateProducts", "TermsAndCondition")] + string Type { get; set; } + + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Rule.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Rule.json.cs new file mode 100644 index 000000000000..5df6d648cd92 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Rule.json.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + public partial class Rule + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRule. + /// + /// a to deserialize from. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRule. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRule FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new Rule(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal Rule(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)_type;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _value;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/RuleListResponse.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RuleListResponse.PowerShell.cs new file mode 100644 index 000000000000..8c0598c6c3ed --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RuleListResponse.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(RuleListResponseTypeConverter))] + public partial class RuleListResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RuleListResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RuleListResponse(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RuleListResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RuleTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponseInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RuleListResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RuleTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponseInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + [System.ComponentModel.TypeConverter(typeof(RuleListResponseTypeConverter))] + public partial interface IRuleListResponse + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/RuleListResponse.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RuleListResponse.TypeConverter.cs new file mode 100644 index 000000000000..bbc5ede989c6 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RuleListResponse.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RuleListResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RuleListResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RuleListResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RuleListResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/RuleListResponse.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RuleListResponse.cs new file mode 100644 index 000000000000..5b133614f9ab --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RuleListResponse.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + public partial class RuleListResponse : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponseInternal + { + + /// Internal Acessors for Value + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponseInternal.Value { get => this._value; set { {_value = value;} } } + + /// Backing field for property. + private string _nextLink; + + /// URL to get the next set of rules list results if there are any. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; } + + /// Creates an new instance. + public RuleListResponse() + { + + } + } + public partial interface IRuleListResponse : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + /// URL to get the next set of rules list results if there are any. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"URL to get the next set of rules list results if there are any.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRule) })] + System.Collections.Generic.List Value { get; } + + } + internal partial interface IRuleListResponseInternal + + { + /// URL to get the next set of rules list results if there are any. + string NextLink { get; set; } + + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/RuleListResponse.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RuleListResponse.json.cs new file mode 100644 index 000000000000..b30adf8b0fa8 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/RuleListResponse.json.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + public partial class RuleListResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new RuleListResponse(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal RuleListResponse(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRule) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Rule.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/SetRulesRequest.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SetRulesRequest.PowerShell.cs new file mode 100644 index 000000000000..1ee956bd9357 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SetRulesRequest.PowerShell.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(SetRulesRequestTypeConverter))] + public partial class SetRulesRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SetRulesRequest(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SetRulesRequest(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SetRulesRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequestInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequestInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RuleTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequestInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequestInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SetRulesRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequestInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequestInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.RuleTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequestInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequestInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + [System.ComponentModel.TypeConverter(typeof(SetRulesRequestTypeConverter))] + public partial interface ISetRulesRequest + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/SetRulesRequest.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SetRulesRequest.TypeConverter.cs new file mode 100644 index 000000000000..ff14493f601d --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SetRulesRequest.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SetRulesRequestTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SetRulesRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SetRulesRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SetRulesRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/SetRulesRequest.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SetRulesRequest.cs new file mode 100644 index 000000000000..042e9def1237 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SetRulesRequest.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + public partial class SetRulesRequest : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequest, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequestInternal + { + + /// Backing field for property. + private string _nextLink; + + /// URL to get the next set of rules list results if there are any. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public SetRulesRequest() + { + + } + } + public partial interface ISetRulesRequest : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + /// URL to get the next set of rules list results if there are any. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"URL to get the next set of rules list results if there are any.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRule) })] + System.Collections.Generic.List Value { get; set; } + + } + internal partial interface ISetRulesRequestInternal + + { + /// URL to get the next set of rules list results if there are any. + string NextLink { get; set; } + + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/SetRulesRequest.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SetRulesRequest.json.cs new file mode 100644 index 000000000000..2a2eb9594d29 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SetRulesRequest.json.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + public partial class SetRulesRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISetRulesRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new SetRulesRequest(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal SetRulesRequest(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRule) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Rule.FromJson(__u) )) ))() : null : _value;} + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)_nextLink;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperation.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperation.PowerShell.cs similarity index 54% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperation.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperation.PowerShell.cs index f4aad89e94d1..d64a9d28ff60 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperation.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperation.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class SingleOperation /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class SingleOperation /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,27 +55,35 @@ public partial class SingleOperation partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperation DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperation DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new SingleOperation(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new SingleOperation(content); } @@ -82,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -101,45 +111,49 @@ internal SingleOperation(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Display")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SingleOperationDisplayTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SingleOperationDisplayTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("IsDataAction")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("Origin")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).Origin, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Origin, global::System.Convert.ToString); } if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAny) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AnyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAny) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AnyTypeConverter.ConvertFrom); } if (content.Contains("DisplayProvider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).DisplayProvider, global::System.Convert.ToString); } if (content.Contains("DisplayResource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).DisplayResource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).DisplayResource, global::System.Convert.ToString); } if (content.Contains("DisplayOperation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).DisplayOperation, global::System.Convert.ToString); } if (content.Contains("DisplayDescription")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).DisplayDescription, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -154,39 +168,43 @@ internal SingleOperation(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("Display")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SingleOperationDisplayTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SingleOperationDisplayTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Id, global::System.Convert.ToString); } if (content.Contains("Name")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Name, global::System.Convert.ToString); } if (content.Contains("IsDataAction")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("Origin")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).Origin, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Origin, global::System.Convert.ToString); } if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAny) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AnyTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAny) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.AnyTypeConverter.ConvertFrom); } if (content.Contains("DisplayProvider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).DisplayProvider, global::System.Convert.ToString); } if (content.Contains("DisplayResource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).DisplayResource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).DisplayResource, global::System.Convert.ToString); } if (content.Contains("DisplayOperation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).DisplayOperation, global::System.Convert.ToString); } if (content.Contains("DisplayDescription")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal)this).DisplayDescription, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -195,6 +213,18 @@ internal SingleOperation(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Microsoft.Marketplace REST API operation [System.ComponentModel.TypeConverter(typeof(SingleOperationTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperation.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperation.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperation.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperation.TypeConverter.cs index 53ded5b3262c..250819fb338d 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperation.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperation.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class SingleOperationTypeConverter : global::System.Management.Au { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperation ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperation ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperation).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperation).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperation.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperation.cs similarity index 70% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperation.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperation.cs index 6321031b738d..4fa42fe39701 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperation.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperation.cs @@ -3,38 +3,45 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Microsoft.Marketplace REST API operation public partial class SingleOperation : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperation, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperation, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplay _display; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplay _display; /// The object that represents the operation. [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplay Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SingleOperationDisplay()); set => this._display = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplay Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SingleOperationDisplay()); set => this._display = value; } /// Friendly description for the operation, [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)Display).Description; } + public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)Display).Description; } /// Operation type [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)Display).Operation; } + public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)Display).Operation; } /// Service provider: Microsoft.Marketplace [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)Display).Provider; } + public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)Display).Provider; } /// Resource on which the operation is performed [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)Display).Resource; } + public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)Display).Resource; } + + /// Backing field for property. + private string _id; + + /// Operation ID + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } /// Backing field for property. private bool? _isDataAction; @@ -44,19 +51,19 @@ public partial class SingleOperation : public bool? IsDataAction { get => this._isDataAction; set => this._isDataAction = value; } /// Internal Acessors for Display - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplay Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SingleOperationDisplay()); set { {_display = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplay Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SingleOperationDisplay()); set { {_display = value;} } } /// Internal Acessors for DisplayDescription - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal.DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)Display).Description = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal.DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)Display).Description = value; } /// Internal Acessors for DisplayOperation - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal.DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)Display).Operation = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal.DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)Display).Operation = value; } /// Internal Acessors for DisplayProvider - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal.DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)Display).Provider = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal.DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)Display).Provider = value; } /// Internal Acessors for DisplayResource - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationInternal.DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)Display).Resource = value; } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationInternal.DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)Display).Resource = value; } /// Backing field for property. private string _name; @@ -93,6 +100,9 @@ public partial interface ISingleOperation : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Friendly description for the operation,", SerializedName = @"description", PossibleTypes = new [] { typeof(string) })] @@ -101,6 +111,9 @@ public partial interface ISingleOperation : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Operation type", SerializedName = @"operation", PossibleTypes = new [] { typeof(string) })] @@ -109,6 +122,9 @@ public partial interface ISingleOperation : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Service provider: Microsoft.Marketplace", SerializedName = @"provider", PossibleTypes = new [] { typeof(string) })] @@ -117,14 +133,31 @@ public partial interface ISingleOperation : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Resource on which the operation is performed", SerializedName = @"resource", PossibleTypes = new [] { typeof(string) })] string DisplayResource { get; } + /// Operation ID + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"Operation ID", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } /// Indicates whether the operation is a data action [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Indicates whether the operation is a data action", SerializedName = @"isDataAction", PossibleTypes = new [] { typeof(bool) })] @@ -133,6 +166,9 @@ public partial interface ISingleOperation : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Operation name: {provider}/{resource}/{operation}", SerializedName = @"name", PossibleTypes = new [] { typeof(string) })] @@ -141,6 +177,9 @@ public partial interface ISingleOperation : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Origin of the operation", SerializedName = @"origin", PossibleTypes = new [] { typeof(string) })] @@ -149,6 +188,9 @@ public partial interface ISingleOperation : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Properties of the operation", SerializedName = @"properties", PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAny) })] @@ -160,7 +202,7 @@ internal partial interface ISingleOperationInternal { /// The object that represents the operation. - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplay Display { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplay Display { get; set; } /// Friendly description for the operation, string DisplayDescription { get; set; } /// Operation type @@ -169,6 +211,8 @@ internal partial interface ISingleOperationInternal string DisplayProvider { get; set; } /// Resource on which the operation is performed string DisplayResource { get; set; } + /// Operation ID + string Id { get; set; } /// Indicates whether the operation is a data action bool? IsDataAction { get; set; } /// Operation name: {provider}/{resource}/{operation} diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperation.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperation.json.cs similarity index 84% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperation.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperation.json.cs index 8314d7c1cf5e..2d6526cb9f9e 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperation.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperation.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class SingleOperation partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class SingleOperation /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class SingleOperation /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class SingleOperation partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperation. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperation. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperation. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperation. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperation FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperation FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new SingleOperation(json) : null; } @@ -75,11 +77,12 @@ internal SingleOperation(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime. { return; } - {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.SingleOperationDisplay.FromJson(__jsonDisplay) : Display;} - {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} - {_isDataAction = If( json?.PropertyT("isDataAction"), out var __jsonIsDataAction) ? (bool?)__jsonIsDataAction : IsDataAction;} - {_origin = If( json?.PropertyT("origin"), out var __jsonOrigin) ? (string)__jsonOrigin : (string)Origin;} - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Any.FromJson(__jsonProperties) : Property;} + {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SingleOperationDisplay.FromJson(__jsonDisplay) : _display;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)_name;} + {_isDataAction = If( json?.PropertyT("isDataAction"), out var __jsonIsDataAction) ? (bool?)__jsonIsDataAction : _isDataAction;} + {_origin = If( json?.PropertyT("origin"), out var __jsonOrigin) ? (string)__jsonOrigin : (string)_origin;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Any.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } @@ -103,6 +106,7 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs return container; } AddIf( null != this._display ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) this._display.ToJson(null,serializationMode) : null, "display" ,container.Add ); + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); AddIf( null != this._isDataAction ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonBoolean((bool)this._isDataAction) : null, "isDataAction" ,container.Add ); AddIf( null != (((object)this._origin)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._origin.ToString()) : null, "origin" ,container.Add ); diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperationDisplay.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperationDisplay.PowerShell.cs similarity index 66% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperationDisplay.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperationDisplay.PowerShell.cs index 74d5e9081cee..b81760962371 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperationDisplay.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperationDisplay.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class SingleOperationDisplay /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class SingleOperationDisplay /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,27 +55,35 @@ public partial class SingleOperationDisplay partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplay DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplay DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new SingleOperationDisplay(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplay DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplay DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new SingleOperationDisplay(content); } @@ -82,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplay FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplay FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -101,25 +111,25 @@ internal SingleOperationDisplay(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Provider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)this).Provider, global::System.Convert.ToString); } if (content.Contains("Resource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)this).Resource, global::System.Convert.ToString); } if (content.Contains("Operation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)this).Operation, global::System.Convert.ToString); } if (content.Contains("Description")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)this).Description, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -134,19 +144,19 @@ internal SingleOperationDisplay(global::System.Management.Automation.PSObject co // actually deserialize if (content.Contains("Provider")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)this).Provider, global::System.Convert.ToString); } if (content.Contains("Resource")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)this).Resource, global::System.Convert.ToString); } if (content.Contains("Operation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)this).Operation, global::System.Convert.ToString); } if (content.Contains("Description")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal)this).Description, global::System.Convert.ToString); } AfterDeserializePSObject(content); } @@ -155,6 +165,18 @@ internal SingleOperationDisplay(global::System.Management.Automation.PSObject co /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// The object that represents the operation. [System.ComponentModel.TypeConverter(typeof(SingleOperationDisplayTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperationDisplay.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperationDisplay.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperationDisplay.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperationDisplay.TypeConverter.cs index e4afce7778f2..fa9fb8e38db5 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperationDisplay.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperationDisplay.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class SingleOperationDisplayTypeConverter : global::System.Manage { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplay ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplay ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplay).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplay).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperationDisplay.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperationDisplay.cs similarity index 84% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperationDisplay.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperationDisplay.cs index 0100e68998fc..d3a01434adf8 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperationDisplay.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperationDisplay.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// The object that represents the operation. public partial class SingleOperationDisplay : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplay, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplay, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal { /// Backing field for property. @@ -21,16 +21,16 @@ public partial class SingleOperationDisplay : public string Description { get => this._description; } /// Internal Acessors for Description - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal.Description { get => this._description; set { {_description = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal.Description { get => this._description; set { {_description = value;} } } /// Internal Acessors for Operation - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal.Operation { get => this._operation; set { {_operation = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal.Operation { get => this._operation; set { {_operation = value;} } } /// Internal Acessors for Provider - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal.Provider { get => this._provider; set { {_provider = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal.Provider { get => this._provider; set { {_provider = value;} } } /// Internal Acessors for Resource - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplayInternal.Resource { get => this._resource; set { {_resource = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplayInternal.Resource { get => this._resource; set { {_resource = value;} } } /// Backing field for property. private string _operation; @@ -67,6 +67,9 @@ public partial interface ISingleOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Friendly description for the operation,", SerializedName = @"description", PossibleTypes = new [] { typeof(string) })] @@ -75,6 +78,9 @@ public partial interface ISingleOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Operation type", SerializedName = @"operation", PossibleTypes = new [] { typeof(string) })] @@ -83,6 +89,9 @@ public partial interface ISingleOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Service provider: Microsoft.Marketplace", SerializedName = @"provider", PossibleTypes = new [] { typeof(string) })] @@ -91,6 +100,9 @@ public partial interface ISingleOperationDisplay : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Resource on which the operation is performed", SerializedName = @"resource", PossibleTypes = new [] { typeof(string) })] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperationDisplay.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperationDisplay.json.cs similarity index 87% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperationDisplay.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperationDisplay.json.cs index c68afb08797c..8e645823901a 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SingleOperationDisplay.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SingleOperationDisplay.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class SingleOperationDisplay partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class SingleOperationDisplay /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class SingleOperationDisplay /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class SingleOperationDisplay partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplay. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplay. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplay. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplay. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISingleOperationDisplay FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISingleOperationDisplay FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new SingleOperationDisplay(json) : null; } @@ -75,10 +77,10 @@ internal SingleOperationDisplay(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.R { return; } - {_provider = If( json?.PropertyT("provider"), out var __jsonProvider) ? (string)__jsonProvider : (string)Provider;} - {_resource = If( json?.PropertyT("resource"), out var __jsonResource) ? (string)__jsonResource : (string)Resource;} - {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)Operation;} - {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)Description;} + {_provider = If( json?.PropertyT("provider"), out var __jsonProvider) ? (string)__jsonProvider : (string)_provider;} + {_resource = If( json?.PropertyT("resource"), out var __jsonResource) ? (string)__jsonResource : (string)_resource;} + {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)_operation;} + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)_description;} AfterFromJson(json); } @@ -101,19 +103,19 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._provider)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._provider.ToString()) : null, "provider" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._resource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._resource.ToString()) : null, "resource" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._operation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._operation.ToString()) : null, "operation" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._description.ToString()) : null, "description" ,container.Add ); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/StopSellNotifications.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellNotifications.PowerShell.cs similarity index 59% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/StopSellNotifications.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellNotifications.PowerShell.cs index 59ce95f50487..fc8c0e4eddcc 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/StopSellNotifications.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellNotifications.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class StopSellNotifications /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class StopSellNotifications /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,27 +55,35 @@ public partial class StopSellNotifications partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotifications DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotifications DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new StopSellNotifications(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotifications DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotifications DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new StopSellNotifications(content); } @@ -82,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotifications FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotifications FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -101,33 +111,33 @@ internal StopSellNotifications(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("OfferId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).OfferId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).OfferId, global::System.Convert.ToString); } if (content.Contains("DisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).DisplayName, global::System.Convert.ToString); } if (content.Contains("IsEntire")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).IsEntire = (bool?) content.GetValueForProperty("IsEntire",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).IsEntire, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).IsEntire = (bool?) content.GetValueForProperty("IsEntire",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).IsEntire, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("MessageCode")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); } if (content.Contains("Icon")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).Icon = (string) content.GetValueForProperty("Icon",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).Icon, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).Icon = (string) content.GetValueForProperty("Icon",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).Icon, global::System.Convert.ToString); } if (content.Contains("Plan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).Plan = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails[]) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).Plan, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanNotificationDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).Plan = (System.Collections.Generic.List) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).Plan, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanNotificationDetailsTypeConverter.ConvertFrom)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -142,27 +152,27 @@ internal StopSellNotifications(global::System.Management.Automation.PSObject con // actually deserialize if (content.Contains("OfferId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).OfferId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).OfferId, global::System.Convert.ToString); } if (content.Contains("DisplayName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).DisplayName, global::System.Convert.ToString); } if (content.Contains("IsEntire")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).IsEntire = (bool?) content.GetValueForProperty("IsEntire",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).IsEntire, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).IsEntire = (bool?) content.GetValueForProperty("IsEntire",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).IsEntire, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); } if (content.Contains("MessageCode")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); } if (content.Contains("Icon")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).Icon = (string) content.GetValueForProperty("Icon",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).Icon, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).Icon = (string) content.GetValueForProperty("Icon",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).Icon, global::System.Convert.ToString); } if (content.Contains("Plan")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).Plan = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails[]) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal)this).Plan, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanNotificationDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).Plan = (System.Collections.Generic.List) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal)this).Plan, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanNotificationDetailsTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } @@ -171,6 +181,18 @@ internal StopSellNotifications(global::System.Management.Automation.PSObject con /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Stop sell notification details [System.ComponentModel.TypeConverter(typeof(StopSellNotificationsTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/StopSellNotifications.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellNotifications.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/StopSellNotifications.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellNotifications.TypeConverter.cs index 3e723df9b057..2e7c0503ec50 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/StopSellNotifications.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellNotifications.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class StopSellNotificationsTypeConverter : global::System.Managem { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotifications ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotifications ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotifications).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotifications).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/StopSellNotifications.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellNotifications.cs similarity index 82% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/StopSellNotifications.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellNotifications.cs index fac687635a9a..5369e33e187d 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/StopSellNotifications.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellNotifications.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Stop sell notification details public partial class StopSellNotifications : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotifications, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotificationsInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotifications, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotificationsInternal { /// Backing field for property. @@ -51,11 +51,11 @@ public partial class StopSellNotifications : public string OfferId { get => this._offerId; set => this._offerId = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails[] _plan; + private System.Collections.Generic.List _plan; /// Gets or sets removed plans notifications [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails[] Plan { get => this._plan; set => this._plan = value; } + public System.Collections.Generic.List Plan { get => this._plan; set => this._plan = value; } /// Creates an new instance. public StopSellNotifications() @@ -71,6 +71,9 @@ public partial interface IStopSellNotifications : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets offer display name", SerializedName = @"displayName", PossibleTypes = new [] { typeof(string) })] @@ -79,6 +82,9 @@ public partial interface IStopSellNotifications : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the icon url", SerializedName = @"icon", PossibleTypes = new [] { typeof(string) })] @@ -89,6 +95,9 @@ public partial interface IStopSellNotifications : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets a value indicating whether entire offer is in stop sell or only few of its plans", SerializedName = @"isEntire", PossibleTypes = new [] { typeof(bool) })] @@ -97,6 +106,9 @@ public partial interface IStopSellNotifications : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets the notification message id", SerializedName = @"messageCode", PossibleTypes = new [] { typeof(long) })] @@ -105,6 +117,9 @@ public partial interface IStopSellNotifications : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets offer id", SerializedName = @"offerId", PossibleTypes = new [] { typeof(string) })] @@ -113,10 +128,13 @@ public partial interface IStopSellNotifications : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets removed plans notifications", SerializedName = @"plans", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails[] Plan { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetails) })] + System.Collections.Generic.List Plan { get; set; } } /// Stop sell notification details @@ -136,7 +154,7 @@ internal partial interface IStopSellNotificationsInternal /// Gets offer id string OfferId { get; set; } /// Gets or sets removed plans notifications - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails[] Plan { get; set; } + System.Collections.Generic.List Plan { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/StopSellNotifications.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellNotifications.json.cs similarity index 86% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/StopSellNotifications.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellNotifications.json.cs index c71290cd21fb..e7a4c008cf51 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/StopSellNotifications.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellNotifications.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class StopSellNotifications partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class StopSellNotifications /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class StopSellNotifications /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class StopSellNotifications partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotifications. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotifications. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotifications. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotifications. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IStopSellNotifications FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellNotifications FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new StopSellNotifications(json) : null; } @@ -75,12 +77,12 @@ internal StopSellNotifications(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Ru { return; } - {_offerId = If( json?.PropertyT("offerId"), out var __jsonOfferId) ? (string)__jsonOfferId : (string)OfferId;} - {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)DisplayName;} - {_isEntire = If( json?.PropertyT("isEntire"), out var __jsonIsEntire) ? (bool?)__jsonIsEntire : IsEntire;} - {_messageCode = If( json?.PropertyT("messageCode"), out var __jsonMessageCode) ? (long?)__jsonMessageCode : MessageCode;} - {_icon = If( json?.PropertyT("icon"), out var __jsonIcon) ? (string)__jsonIcon : (string)Icon;} - {_plan = If( json?.PropertyT("plans"), out var __jsonPlans) ? If( __jsonPlans as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlanNotificationDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PlanNotificationDetails.FromJson(__u) )) ))() : null : Plan;} + {_offerId = If( json?.PropertyT("offerId"), out var __jsonOfferId) ? (string)__jsonOfferId : (string)_offerId;} + {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)_displayName;} + {_isEntire = If( json?.PropertyT("isEntire"), out var __jsonIsEntire) ? (bool?)__jsonIsEntire : _isEntire;} + {_messageCode = If( json?.PropertyT("messageCode"), out var __jsonMessageCode) ? (long?)__jsonMessageCode : _messageCode;} + {_icon = If( json?.PropertyT("icon"), out var __jsonIcon) ? (string)__jsonIcon : (string)_icon;} + {_plan = If( json?.PropertyT("plans"), out var __jsonPlans) ? If( __jsonPlans as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanNotificationDetails.FromJson(__u) )) ))() : null : _plan;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsList.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsList.PowerShell.cs new file mode 100644 index 000000000000..3835e138a76b --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsList.PowerShell.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// List of stop sell offers and plans notifications. + [System.ComponentModel.TypeConverter(typeof(StopSellOffersPlansNotificationsListTypeConverter))] + public partial class StopSellOffersPlansNotificationsList + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsList DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StopSellOffersPlansNotificationsList(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StopSellOffersPlansNotificationsList(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StopSellOffersPlansNotificationsList(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StopSellNotification")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListInternal)this).StopSellNotification = (System.Collections.Generic.List) content.GetValueForProperty("StopSellNotification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListInternal)this).StopSellNotification, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.StopSellOffersPlansNotificationsListPropertiesTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StopSellOffersPlansNotificationsList(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StopSellNotification")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListInternal)this).StopSellNotification = (System.Collections.Generic.List) content.GetValueForProperty("StopSellNotification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListInternal)this).StopSellNotification, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.StopSellOffersPlansNotificationsListPropertiesTypeConverter.ConvertFrom)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// List of stop sell offers and plans notifications. + [System.ComponentModel.TypeConverter(typeof(StopSellOffersPlansNotificationsListTypeConverter))] + public partial interface IStopSellOffersPlansNotificationsList + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsList.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsList.TypeConverter.cs new file mode 100644 index 000000000000..d226661dcf6e --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsList.TypeConverter.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StopSellOffersPlansNotificationsListTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsList ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsList).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StopSellOffersPlansNotificationsList.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StopSellOffersPlansNotificationsList.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StopSellOffersPlansNotificationsList.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsList.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsList.cs new file mode 100644 index 000000000000..952613a9b5f9 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsList.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// List of stop sell offers and plans notifications. + public partial class StopSellOffersPlansNotificationsList : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsList, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _stopSellNotification; + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List StopSellNotification { get => this._stopSellNotification; set => this._stopSellNotification = value; } + + /// Creates an new instance. + public StopSellOffersPlansNotificationsList() + { + + } + } + /// List of stop sell offers and plans notifications. + public partial interface IStopSellOffersPlansNotificationsList : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"", + SerializedName = @"stopSellNotifications", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListProperties) })] + System.Collections.Generic.List StopSellNotification { get; set; } + + } + /// List of stop sell offers and plans notifications. + internal partial interface IStopSellOffersPlansNotificationsListInternal + + { + System.Collections.Generic.List StopSellNotification { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsList.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsList.json.cs new file mode 100644 index 000000000000..184fe42464ab --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsList.json.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// List of stop sell offers and plans notifications. + public partial class StopSellOffersPlansNotificationsList + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsList. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsList. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsList FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new StopSellOffersPlansNotificationsList(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal StopSellOffersPlansNotificationsList(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_stopSellNotification = If( json?.PropertyT("stopSellNotifications"), out var __jsonStopSellNotifications) ? If( __jsonStopSellNotifications as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListProperties) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.StopSellOffersPlansNotificationsListProperties.FromJson(__u) )) ))() : null : _stopSellNotification;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._stopSellNotification) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __x in this._stopSellNotification ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("stopSellNotifications",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsListProperties.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsListProperties.PowerShell.cs new file mode 100644 index 000000000000..fc7357c2be69 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsListProperties.PowerShell.cs @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// List of stop sell offers and plans notifications. + [System.ComponentModel.TypeConverter(typeof(StopSellOffersPlansNotificationsListPropertiesTypeConverter))] + public partial class StopSellOffersPlansNotificationsListProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StopSellOffersPlansNotificationsListProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StopSellOffersPlansNotificationsListProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StopSellOffersPlansNotificationsListProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).OfferId, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("IsEntire")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).IsEntire = (bool?) content.GetValueForProperty("IsEntire",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).IsEntire, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MessageCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("Icon")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).Icon = (string) content.GetValueForProperty("Icon",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).Icon, global::System.Convert.ToString); + } + if (content.Contains("Plan")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).Plan = (System.Collections.Generic.List) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).Plan, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanNotificationDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("PublicContext")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).PublicContext = (bool?) content.GetValueForProperty("PublicContext",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).PublicContext, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SubscriptionsId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).SubscriptionsId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionsId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).SubscriptionsId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StopSellOffersPlansNotificationsListProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("OfferId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).OfferId = (string) content.GetValueForProperty("OfferId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).OfferId, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("IsEntire")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).IsEntire = (bool?) content.GetValueForProperty("IsEntire",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).IsEntire, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("MessageCode")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).MessageCode = (long?) content.GetValueForProperty("MessageCode",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).MessageCode, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("Icon")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).Icon = (string) content.GetValueForProperty("Icon",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).Icon, global::System.Convert.ToString); + } + if (content.Contains("Plan")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).Plan = (System.Collections.Generic.List) content.GetValueForProperty("Plan",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).Plan, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanNotificationDetailsTypeConverter.ConvertFrom)); + } + if (content.Contains("PublicContext")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).PublicContext = (bool?) content.GetValueForProperty("PublicContext",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).PublicContext, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("SubscriptionsId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).SubscriptionsId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionsId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal)this).SubscriptionsId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// List of stop sell offers and plans notifications. + [System.ComponentModel.TypeConverter(typeof(StopSellOffersPlansNotificationsListPropertiesTypeConverter))] + public partial interface IStopSellOffersPlansNotificationsListProperties + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsListProperties.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsListProperties.TypeConverter.cs new file mode 100644 index 000000000000..7a5be08c2858 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsListProperties.TypeConverter.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StopSellOffersPlansNotificationsListPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StopSellOffersPlansNotificationsListProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StopSellOffersPlansNotificationsListProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StopSellOffersPlansNotificationsListProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsListProperties.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsListProperties.cs new file mode 100644 index 000000000000..8bd219173ab5 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsListProperties.cs @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// List of stop sell offers and plans notifications. + public partial class StopSellOffersPlansNotificationsListProperties : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListProperties, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal + { + + /// Backing field for property. + private string _displayName; + + /// The offer display name + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string DisplayName { get => this._displayName; } + + /// Backing field for property. + private string _icon; + + /// The icon url + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string Icon { get => this._icon; } + + /// Backing field for property. + private bool? _isEntire; + + /// + /// A value indicating whether entire offer is in stop sell or only few of its plans + /// + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public bool? IsEntire { get => this._isEntire; } + + /// Backing field for property. + private long? _messageCode; + + /// The notification message code + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public long? MessageCode { get => this._messageCode; } + + /// Internal Acessors for DisplayName + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal.DisplayName { get => this._displayName; set { {_displayName = value;} } } + + /// Internal Acessors for Icon + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal.Icon { get => this._icon; set { {_icon = value;} } } + + /// Internal Acessors for IsEntire + bool? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal.IsEntire { get => this._isEntire; set { {_isEntire = value;} } } + + /// Internal Acessors for MessageCode + long? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal.MessageCode { get => this._messageCode; set { {_messageCode = value;} } } + + /// Internal Acessors for OfferId + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal.OfferId { get => this._offerId; set { {_offerId = value;} } } + + /// Internal Acessors for Plan + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal.Plan { get => this._plan; set { {_plan = value;} } } + + /// Internal Acessors for PublicContext + bool? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal.PublicContext { get => this._publicContext; set { {_publicContext = value;} } } + + /// Internal Acessors for SubscriptionsId + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListPropertiesInternal.SubscriptionsId { get => this._subscriptionsId; set { {_subscriptionsId = value;} } } + + /// Backing field for property. + private string _offerId; + + /// The offer id + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string OfferId { get => this._offerId; } + + /// Backing field for property. + private System.Collections.Generic.List _plan; + + /// The list of removed plans notifications + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List Plan { get => this._plan; } + + /// Backing field for property. + private bool? _publicContext; + + /// True if the offer has public plans + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public bool? PublicContext { get => this._publicContext; } + + /// Backing field for property. + private System.Collections.Generic.List _subscriptionsId; + + /// The subscriptions related to private plans + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List SubscriptionsId { get => this._subscriptionsId; } + + /// + /// Creates an new instance. + /// + public StopSellOffersPlansNotificationsListProperties() + { + + } + } + /// List of stop sell offers and plans notifications. + public partial interface IStopSellOffersPlansNotificationsListProperties : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + /// The offer display name + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The offer display name", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + string DisplayName { get; } + /// The icon url + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The icon url", + SerializedName = @"icon", + PossibleTypes = new [] { typeof(string) })] + string Icon { get; } + /// + /// A value indicating whether entire offer is in stop sell or only few of its plans + /// + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"A value indicating whether entire offer is in stop sell or only few of its plans", + SerializedName = @"isEntire", + PossibleTypes = new [] { typeof(bool) })] + bool? IsEntire { get; } + /// The notification message code + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The notification message code", + SerializedName = @"messageCode", + PossibleTypes = new [] { typeof(long) })] + long? MessageCode { get; } + /// The offer id + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The offer id", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + string OfferId { get; } + /// The list of removed plans notifications + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The list of removed plans notifications", + SerializedName = @"plans", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetails) })] + System.Collections.Generic.List Plan { get; } + /// True if the offer has public plans + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"True if the offer has public plans", + SerializedName = @"publicContext", + PossibleTypes = new [] { typeof(bool) })] + bool? PublicContext { get; } + /// The subscriptions related to private plans + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The subscriptions related to private plans", + SerializedName = @"subscriptionsIds", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List SubscriptionsId { get; } + + } + /// List of stop sell offers and plans notifications. + internal partial interface IStopSellOffersPlansNotificationsListPropertiesInternal + + { + /// The offer display name + string DisplayName { get; set; } + /// The icon url + string Icon { get; set; } + /// + /// A value indicating whether entire offer is in stop sell or only few of its plans + /// + bool? IsEntire { get; set; } + /// The notification message code + long? MessageCode { get; set; } + /// The offer id + string OfferId { get; set; } + /// The list of removed plans notifications + System.Collections.Generic.List Plan { get; set; } + /// True if the offer has public plans + bool? PublicContext { get; set; } + /// The subscriptions related to private plans + System.Collections.Generic.List SubscriptionsId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsListProperties.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsListProperties.json.cs new file mode 100644 index 000000000000..3d8ada4af757 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellOffersPlansNotificationsListProperties.json.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// List of stop sell offers and plans notifications. + public partial class StopSellOffersPlansNotificationsListProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellOffersPlansNotificationsListProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new StopSellOffersPlansNotificationsListProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal StopSellOffersPlansNotificationsListProperties(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_offerId = If( json?.PropertyT("offerId"), out var __jsonOfferId) ? (string)__jsonOfferId : (string)_offerId;} + {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)_displayName;} + {_isEntire = If( json?.PropertyT("isEntire"), out var __jsonIsEntire) ? (bool?)__jsonIsEntire : _isEntire;} + {_messageCode = If( json?.PropertyT("messageCode"), out var __jsonMessageCode) ? (long?)__jsonMessageCode : _messageCode;} + {_icon = If( json?.PropertyT("icon"), out var __jsonIcon) ? (string)__jsonIcon : (string)_icon;} + {_plan = If( json?.PropertyT("plans"), out var __jsonPlans) ? If( __jsonPlans as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlanNotificationDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PlanNotificationDetails.FromJson(__u) )) ))() : null : _plan;} + {_publicContext = If( json?.PropertyT("publicContext"), out var __jsonPublicContext) ? (bool?)__jsonPublicContext : _publicContext;} + {_subscriptionsId = If( json?.PropertyT("subscriptionsIds"), out var __jsonSubscriptionsIds) ? If( __jsonSubscriptionsIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : _subscriptionsId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._offerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._offerId.ToString()) : null, "offerId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._displayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._displayName.ToString()) : null, "displayName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._isEntire ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonBoolean((bool)this._isEntire) : null, "isEntire" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._messageCode ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNumber((long)this._messageCode) : null, "messageCode" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._icon)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._icon.ToString()) : null, "icon" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._plan) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __x in this._plan ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("plans",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._publicContext ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonBoolean((bool)this._publicContext) : null, "publicContext" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._subscriptionsId) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __s in this._subscriptionsId ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("subscriptionsIds",__r); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellSubscriptions.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellSubscriptions.PowerShell.cs new file mode 100644 index 000000000000..bdd7a5a88eb3 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellSubscriptions.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// Private plans subscriptions + [System.ComponentModel.TypeConverter(typeof(StopSellSubscriptionsTypeConverter))] + public partial class StopSellSubscriptions + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellSubscriptions DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StopSellSubscriptions(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellSubscriptions DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StopSellSubscriptions(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellSubscriptions FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StopSellSubscriptions(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Subscription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellSubscriptionsInternal)this).Subscription = (System.Collections.Generic.List) content.GetValueForProperty("Subscription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellSubscriptionsInternal)this).Subscription, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StopSellSubscriptions(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Subscription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellSubscriptionsInternal)this).Subscription = (System.Collections.Generic.List) content.GetValueForProperty("Subscription",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellSubscriptionsInternal)this).Subscription, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Private plans subscriptions + [System.ComponentModel.TypeConverter(typeof(StopSellSubscriptionsTypeConverter))] + public partial interface IStopSellSubscriptions + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellSubscriptions.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellSubscriptions.TypeConverter.cs new file mode 100644 index 000000000000..eee43c92bb04 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellSubscriptions.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StopSellSubscriptionsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellSubscriptions ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellSubscriptions).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StopSellSubscriptions.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StopSellSubscriptions.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StopSellSubscriptions.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellSubscriptions.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellSubscriptions.cs new file mode 100644 index 000000000000..63cce3ec1d02 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellSubscriptions.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Private plans subscriptions + public partial class StopSellSubscriptions : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellSubscriptions, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellSubscriptionsInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _subscription; + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List Subscription { get => this._subscription; set => this._subscription = value; } + + /// Creates an new instance. + public StopSellSubscriptions() + { + + } + } + /// Private plans subscriptions + public partial interface IStopSellSubscriptions : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"", + SerializedName = @"subscriptions", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List Subscription { get; set; } + + } + /// Private plans subscriptions + internal partial interface IStopSellSubscriptionsInternal + + { + System.Collections.Generic.List Subscription { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellSubscriptions.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellSubscriptions.json.cs new file mode 100644 index 000000000000..a7921e7aa426 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/StopSellSubscriptions.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Private plans subscriptions + public partial class StopSellSubscriptions + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellSubscriptions. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellSubscriptions. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IStopSellSubscriptions FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new StopSellSubscriptions(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal StopSellSubscriptions(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_subscription = If( json?.PropertyT("subscriptions"), out var __jsonSubscriptions) ? If( __jsonSubscriptions as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _subscription;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._subscription) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __x in this._subscription ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("subscriptions",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Subscription.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Subscription.PowerShell.cs new file mode 100644 index 000000000000..295d14cba7e4 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Subscription.PowerShell.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// Subscription information. + [System.ComponentModel.TypeConverter(typeof(SubscriptionTypeConverter))] + public partial class Subscription + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscription DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Subscription(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscription DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Subscription(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscription FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Subscription(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal)this).SubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal)this).State, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Subscription(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal)this).SubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal)this).State, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Subscription information. + [System.ComponentModel.TypeConverter(typeof(SubscriptionTypeConverter))] + public partial interface ISubscription + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Subscription.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Subscription.TypeConverter.cs new file mode 100644 index 000000000000..53a818ccb7f9 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Subscription.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SubscriptionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscription ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscription).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Subscription.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Subscription.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Subscription.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Subscription.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Subscription.cs new file mode 100644 index 000000000000..84e962ab6474 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Subscription.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Subscription information. + public partial class Subscription : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscription, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal + { + + /// Backing field for property. + private string _displayName; + + /// The subscription display name. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string DisplayName { get => this._displayName; } + + /// Backing field for property. + private string _id; + + /// + /// The fully qualified ID for the subscription. For example, /subscriptions/00000000-0000-0000-0000-000000000000. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Internal Acessors for DisplayName + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal.DisplayName { get => this._displayName; set { {_displayName = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for State + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal.State { get => this._state; set { {_state = value;} } } + + /// Internal Acessors for SubscriptionId + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionInternal.SubscriptionId { get => this._subscriptionId; set { {_subscriptionId = value;} } } + + /// Backing field for property. + private string _state; + + /// + /// The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string State { get => this._state; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription ID. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string SubscriptionId { get => this._subscriptionId; } + + /// Creates an new instance. + public Subscription() + { + + } + } + /// Subscription information. + public partial interface ISubscription : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + /// The subscription display name. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The subscription display name.", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + string DisplayName { get; } + /// + /// The fully qualified ID for the subscription. For example, /subscriptions/00000000-0000-0000-0000-000000000000. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The fully qualified ID for the subscription. For example, /subscriptions/00000000-0000-0000-0000-000000000000.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// + /// The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("Enabled", "Warned", "PastDue", "Disabled", "Deleted")] + string State { get; } + /// The subscription ID. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The subscription ID.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + string SubscriptionId { get; } + + } + /// Subscription information. + internal partial interface ISubscriptionInternal + + { + /// The subscription display name. + string DisplayName { get; set; } + /// + /// The fully qualified ID for the subscription. For example, /subscriptions/00000000-0000-0000-0000-000000000000. + /// + string Id { get; set; } + /// + /// The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("Enabled", "Warned", "PastDue", "Disabled", "Deleted")] + string State { get; set; } + /// The subscription ID. + string SubscriptionId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Subscription.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Subscription.json.cs new file mode 100644 index 000000000000..7cd674a52983 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/Subscription.json.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Subscription information. + public partial class Subscription + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscription. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscription. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscription FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new Subscription(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal Subscription(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)_id;} + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)_subscriptionId;} + {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)_displayName;} + {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)_state;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._subscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._subscriptionId.ToString()) : null, "subscriptionId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._displayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._displayName.ToString()) : null, "displayName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._state)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._state.ToString()) : null, "state" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsContextList.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsContextList.PowerShell.cs new file mode 100644 index 000000000000..191bf72cef17 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsContextList.PowerShell.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// List of subscription Ids in the private store + [System.ComponentModel.TypeConverter(typeof(SubscriptionsContextListTypeConverter))] + public partial class SubscriptionsContextList + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextList DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SubscriptionsContextList(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SubscriptionsContextList(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SubscriptionsContextList(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SubscriptionsId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextListInternal)this).SubscriptionsId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionsId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextListInternal)this).SubscriptionsId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SubscriptionsContextList(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SubscriptionsId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextListInternal)this).SubscriptionsId = (System.Collections.Generic.List) content.GetValueForProperty("SubscriptionsId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextListInternal)this).SubscriptionsId, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// List of subscription Ids in the private store + [System.ComponentModel.TypeConverter(typeof(SubscriptionsContextListTypeConverter))] + public partial interface ISubscriptionsContextList + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsContextList.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsContextList.TypeConverter.cs new file mode 100644 index 000000000000..7f427c73c04a --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsContextList.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SubscriptionsContextListTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextList ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextList).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SubscriptionsContextList.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SubscriptionsContextList.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SubscriptionsContextList.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsContextList.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsContextList.cs new file mode 100644 index 000000000000..97a896949f71 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsContextList.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// List of subscription Ids in the private store + public partial class SubscriptionsContextList : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextList, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextListInternal + { + + /// Backing field for property. + private System.Collections.Generic.List _subscriptionsId; + + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List SubscriptionsId { get => this._subscriptionsId; set => this._subscriptionsId = value; } + + /// Creates an new instance. + public SubscriptionsContextList() + { + + } + } + /// List of subscription Ids in the private store + public partial interface ISubscriptionsContextList : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Read = true, + Create = true, + Update = true, + Description = @"", + SerializedName = @"subscriptionsIds", + PossibleTypes = new [] { typeof(string) })] + System.Collections.Generic.List SubscriptionsId { get; set; } + + } + /// List of subscription Ids in the private store + internal partial interface ISubscriptionsContextListInternal + + { + System.Collections.Generic.List SubscriptionsId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsContextList.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsContextList.json.cs new file mode 100644 index 000000000000..3275d01ddf61 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsContextList.json.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// List of subscription Ids in the private store + public partial class SubscriptionsContextList + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextList. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextList. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextList FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new SubscriptionsContextList(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal SubscriptionsContextList(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_subscriptionsId = If( json?.PropertyT("subscriptionsIds"), out var __jsonSubscriptionsIds) ? If( __jsonSubscriptionsIds as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _subscriptionsId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._subscriptionsId) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __x in this._subscriptionsId ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("subscriptionsIds",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsResponse.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsResponse.PowerShell.cs new file mode 100644 index 000000000000..dd4b4d6d8190 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsResponse.PowerShell.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// Subscription list operation response. + [System.ComponentModel.TypeConverter(typeof(SubscriptionsResponseTypeConverter))] + public partial class SubscriptionsResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SubscriptionsResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SubscriptionsResponse(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SubscriptionsResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SubscriptionTypeConverter.ConvertFrom)); + } + if (content.Contains("SkipToken")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponseInternal)this).SkipToken = (string) content.GetValueForProperty("SkipToken",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponseInternal)this).SkipToken, global::System.Convert.ToString); + } + if (content.Contains("Count")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponseInternal)this).Count = (long?) content.GetValueForProperty("Count",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponseInternal)this).Count, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SubscriptionsResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Value")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponseInternal)this).Value = (System.Collections.Generic.List) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.SubscriptionTypeConverter.ConvertFrom)); + } + if (content.Contains("SkipToken")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponseInternal)this).SkipToken = (string) content.GetValueForProperty("SkipToken",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponseInternal)this).SkipToken, global::System.Convert.ToString); + } + if (content.Contains("Count")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponseInternal)this).Count = (long?) content.GetValueForProperty("Count",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponseInternal)this).Count, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + } + /// Subscription list operation response. + [System.ComponentModel.TypeConverter(typeof(SubscriptionsResponseTypeConverter))] + public partial interface ISubscriptionsResponse + + { + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsResponse.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsResponse.TypeConverter.cs new file mode 100644 index 000000000000..519771668b38 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsResponse.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SubscriptionsResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SubscriptionsResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SubscriptionsResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SubscriptionsResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsResponse.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsResponse.cs new file mode 100644 index 000000000000..d802f4def2cb --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsResponse.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Subscription list operation response. + public partial class SubscriptionsResponse : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponseInternal + { + + /// Backing field for property. + private long? _count; + + /// Number of subscriptions on the page + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public long? Count { get => this._count; } + + /// Internal Acessors for Count + long? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponseInternal.Count { get => this._count; set { {_count = value;} } } + + /// Internal Acessors for SkipToken + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponseInternal.SkipToken { get => this._skipToken; set { {_skipToken = value;} } } + + /// Internal Acessors for Value + System.Collections.Generic.List Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponseInternal.Value { get => this._value; set { {_value = value;} } } + + /// Backing field for property. + private string _skipToken; + + /// The skip token to retrieve the next page. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public string SkipToken { get => this._skipToken; } + + /// Backing field for property. + private System.Collections.Generic.List _value; + + /// An array of subscriptions. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] + public System.Collections.Generic.List Value { get => this._value; } + + /// Creates an new instance. + public SubscriptionsResponse() + { + + } + } + /// Subscription list operation response. + public partial interface ISubscriptionsResponse : + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable + { + /// Number of subscriptions on the page + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"Number of subscriptions on the page", + SerializedName = @"count", + PossibleTypes = new [] { typeof(long) })] + long? Count { get; } + /// The skip token to retrieve the next page. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"The skip token to retrieve the next page.", + SerializedName = @"skipToken", + PossibleTypes = new [] { typeof(string) })] + string SkipToken { get; } + /// An array of subscriptions. + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = true, + Read = true, + Create = false, + Update = false, + Description = @"An array of subscriptions.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscription) })] + System.Collections.Generic.List Value { get; } + + } + /// Subscription list operation response. + internal partial interface ISubscriptionsResponseInternal + + { + /// Number of subscriptions on the page + long? Count { get; set; } + /// The skip token to retrieve the next page. + string SkipToken { get; set; } + /// An array of subscriptions. + System.Collections.Generic.List Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsResponse.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsResponse.json.cs new file mode 100644 index 000000000000..7460ec99ca84 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SubscriptionsResponse.json.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// Subscription list operation response. + public partial class SubscriptionsResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new SubscriptionsResponse(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject instance to deserialize from. + internal SubscriptionsResponse(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscription) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Subscription.FromJson(__u) )) ))() : null : _value;} + {_skipToken = If( json?.PropertyT("skipToken"), out var __jsonSkipToken) ? (string)__jsonSkipToken : (string)_skipToken;} + {_count = If( json?.PropertyT("count"), out var __jsonCount) ? (long?)__jsonCount : _count;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != (((object)this._skipToken)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._skipToken.ToString()) : null, "skipToken" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) + { + AddIf( null != this._count ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNumber((long)this._count) : null, "count" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SystemData.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SystemData.PowerShell.cs similarity index 60% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SystemData.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/SystemData.PowerShell.cs index 6f062429f00d..0fdfc3733d04 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SystemData.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SystemData.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class SystemData /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class SystemData /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,27 +55,35 @@ public partial class SystemData partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new SystemData(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new SystemData(content); } @@ -82,11 +92,11 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -101,33 +111,33 @@ internal SystemData(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("CreatedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); } if (content.Contains("CreatedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).CreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).CreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).CreatedByType, global::System.Convert.ToString); } if (content.Contains("CreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("LastModifiedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); } if (content.Contains("LastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).LastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).LastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).LastModifiedByType, global::System.Convert.ToString); } if (content.Contains("LastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -142,27 +152,27 @@ internal SystemData(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("CreatedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).CreatedBy, global::System.Convert.ToString); } if (content.Contains("CreatedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).CreatedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).CreatedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).CreatedByType, global::System.Convert.ToString); } if (content.Contains("CreatedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } if (content.Contains("LastModifiedBy")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).LastModifiedBy, global::System.Convert.ToString); } if (content.Contains("LastModifiedByType")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).LastModifiedByType = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType?) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).LastModifiedByType, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).LastModifiedByType, global::System.Convert.ToString); } if (content.Contains("LastModifiedAt")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); } AfterDeserializePSObject(content); } @@ -171,6 +181,18 @@ internal SystemData(global::System.Management.Automation.PSObject content) /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } } /// Read only system data [System.ComponentModel.TypeConverter(typeof(SystemDataTypeConverter))] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SystemData.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SystemData.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SystemData.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/SystemData.TypeConverter.cs index b981a699b7bc..67058301ffac 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SystemData.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SystemData.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,19 @@ public partial class SystemDataTypeConverter : global::System.Management.Automat { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +74,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +99,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SystemData.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SystemData.cs similarity index 77% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SystemData.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/SystemData.cs index b0492b50165b..f858f38f8dac 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SystemData.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SystemData.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Read only system data public partial class SystemData : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemDataInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemDataInternal { /// Backing field for property. @@ -28,11 +28,11 @@ public partial class SystemData : public string CreatedBy { get => this._createdBy; set => this._createdBy = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? _createdByType; + private string _createdByType; /// The type of identity that created the resource [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? CreatedByType { get => this._createdByType; set => this._createdByType = value; } + public string CreatedByType { get => this._createdByType; set => this._createdByType = value; } /// Backing field for property. private global::System.DateTime? _lastModifiedAt; @@ -49,11 +49,11 @@ public partial class SystemData : public string LastModifiedBy { get => this._lastModifiedBy; set => this._lastModifiedBy = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? _lastModifiedByType; + private string _lastModifiedByType; /// The type of identity that last modified the resource [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? LastModifiedByType { get => this._lastModifiedByType; set => this._lastModifiedByType = value; } + public string LastModifiedByType { get => this._lastModifiedByType; set => this._lastModifiedByType = value; } /// Creates an new instance. public SystemData() @@ -69,6 +69,9 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The timestamp of resource creation (UTC)", SerializedName = @"createdAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] @@ -77,6 +80,9 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The identity that created the resource.", SerializedName = @"createdBy", PossibleTypes = new [] { typeof(string) })] @@ -85,14 +91,21 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The type of identity that created the resource", SerializedName = @"createdByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? CreatedByType { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string CreatedByType { get; set; } /// The timestamp of resource last modification (UTC) [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The timestamp of resource last modification (UTC)", SerializedName = @"lastModifiedAt", PossibleTypes = new [] { typeof(global::System.DateTime) })] @@ -101,6 +114,9 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The identity that last modified the resource.", SerializedName = @"lastModifiedBy", PossibleTypes = new [] { typeof(string) })] @@ -109,10 +125,14 @@ public partial interface ISystemData : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The type of identity that last modified the resource", SerializedName = @"lastModifiedByType", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? LastModifiedByType { get; set; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string LastModifiedByType { get; set; } } /// Read only system data @@ -124,13 +144,15 @@ internal partial interface ISystemDataInternal /// The identity that created the resource. string CreatedBy { get; set; } /// The type of identity that created the resource - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? CreatedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string CreatedByType { get; set; } /// The timestamp of resource last modification (UTC) global::System.DateTime? LastModifiedAt { get; set; } /// The identity that last modified the resource. string LastModifiedBy { get; set; } /// The type of identity that last modified the resource - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType? LastModifiedByType { get; set; } + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("User", "Application", "ManagedIdentity", "Key")] + string LastModifiedByType { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SystemData.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SystemData.json.cs similarity index 90% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SystemData.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/SystemData.json.cs index 46a1af1ce67f..4789958b1c10 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/SystemData.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/SystemData.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class SystemData partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class SystemData /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class SystemData /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class SystemData partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ISystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new SystemData(json) : null; } @@ -75,12 +77,12 @@ internal SystemData(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json. { return; } - {_createdBy = If( json?.PropertyT("createdBy"), out var __jsonCreatedBy) ? (string)__jsonCreatedBy : (string)CreatedBy;} - {_createdByType = If( json?.PropertyT("createdByType"), out var __jsonCreatedByType) ? (string)__jsonCreatedByType : (string)CreatedByType;} - {_createdAt = If( json?.PropertyT("createdAt"), out var __jsonCreatedAt) ? global::System.DateTime.TryParse((string)__jsonCreatedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonCreatedAtValue) ? __jsonCreatedAtValue : CreatedAt : CreatedAt;} - {_lastModifiedBy = If( json?.PropertyT("lastModifiedBy"), out var __jsonLastModifiedBy) ? (string)__jsonLastModifiedBy : (string)LastModifiedBy;} - {_lastModifiedByType = If( json?.PropertyT("lastModifiedByType"), out var __jsonLastModifiedByType) ? (string)__jsonLastModifiedByType : (string)LastModifiedByType;} - {_lastModifiedAt = If( json?.PropertyT("lastModifiedAt"), out var __jsonLastModifiedAt) ? global::System.DateTime.TryParse((string)__jsonLastModifiedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastModifiedAtValue) ? __jsonLastModifiedAtValue : LastModifiedAt : LastModifiedAt;} + {_createdBy = If( json?.PropertyT("createdBy"), out var __jsonCreatedBy) ? (string)__jsonCreatedBy : (string)_createdBy;} + {_createdByType = If( json?.PropertyT("createdByType"), out var __jsonCreatedByType) ? (string)__jsonCreatedByType : (string)_createdByType;} + {_createdAt = If( json?.PropertyT("createdAt"), out var __jsonCreatedAt) ? global::System.DateTime.TryParse((string)__jsonCreatedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonCreatedAtValue) ? __jsonCreatedAtValue : _createdAt : _createdAt;} + {_lastModifiedBy = If( json?.PropertyT("lastModifiedBy"), out var __jsonLastModifiedBy) ? (string)__jsonLastModifiedBy : (string)_lastModifiedBy;} + {_lastModifiedByType = If( json?.PropertyT("lastModifiedByType"), out var __jsonLastModifiedByType) ? (string)__jsonLastModifiedByType : (string)_lastModifiedByType;} + {_lastModifiedAt = If( json?.PropertyT("lastModifiedAt"), out var __jsonLastModifiedAt) ? global::System.DateTime.TryParse((string)__jsonLastModifiedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastModifiedAtValue) ? __jsonLastModifiedAtValue : _lastModifiedAt : _lastModifiedAt;} AfterFromJson(json); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersDetails.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersDetails.PowerShell.cs similarity index 65% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersDetails.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersDetails.PowerShell.cs index 6611a9e3e554..a32f3bb263bb 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersDetails.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersDetails.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class TransferOffersDetails /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class TransferOffersDetails /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,27 +55,35 @@ public partial class TransferOffersDetails partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new TransferOffersDetails(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new TransferOffersDetails(content); } @@ -82,16 +92,28 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -106,21 +128,21 @@ internal TransferOffersDetails(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("TargetCollection")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetailsInternal)this).TargetCollection = (string[]) content.GetValueForProperty("TargetCollection",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetailsInternal)this).TargetCollection, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetailsInternal)this).TargetCollection = (System.Collections.Generic.List) content.GetValueForProperty("TargetCollection",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetailsInternal)this).TargetCollection, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("Operation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetailsInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetailsInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetailsInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetailsInternal)this).Operation, global::System.Convert.ToString); } if (content.Contains("OfferIdsList")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetailsInternal)this).OfferIdsList = (string[]) content.GetValueForProperty("OfferIdsList",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetailsInternal)this).OfferIdsList, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetailsInternal)this).OfferIdsList = (System.Collections.Generic.List) content.GetValueForProperty("OfferIdsList",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetailsInternal)this).OfferIdsList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -135,15 +157,15 @@ internal TransferOffersDetails(global::System.Management.Automation.PSObject con // actually deserialize if (content.Contains("TargetCollection")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetailsInternal)this).TargetCollection = (string[]) content.GetValueForProperty("TargetCollection",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetailsInternal)this).TargetCollection, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetailsInternal)this).TargetCollection = (System.Collections.Generic.List) content.GetValueForProperty("TargetCollection",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetailsInternal)this).TargetCollection, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("Operation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetailsInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetailsInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetailsInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetailsInternal)this).Operation, global::System.Convert.ToString); } if (content.Contains("OfferIdsList")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetailsInternal)this).OfferIdsList = (string[]) content.GetValueForProperty("OfferIdsList",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetailsInternal)this).OfferIdsList, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetailsInternal)this).OfferIdsList = (System.Collections.Generic.List) content.GetValueForProperty("OfferIdsList",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetailsInternal)this).OfferIdsList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializePSObject(content); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersDetails.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersDetails.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersDetails.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersDetails.TypeConverter.cs index 80c9333b32c0..78811c822c84 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersDetails.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersDetails.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class TransferOffersDetailsTypeConverter : global::System.Managem { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetails ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetails ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetails).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetails).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersDetails.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersDetails.cs similarity index 74% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersDetails.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersDetails.cs index e623e565bd0e..4afe28685931 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersDetails.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersDetails.cs @@ -3,22 +3,22 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Transfer offers response details public partial class TransferOffersDetails : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetails, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetailsInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetails, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetailsInternal { /// Backing field for property. - private string[] _offerIdsList; + private System.Collections.Generic.List _offerIdsList; /// Offers ids list to transfer from source collection to target collection(s) [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public string[] OfferIdsList { get => this._offerIdsList; set => this._offerIdsList = value; } + public System.Collections.Generic.List OfferIdsList { get => this._offerIdsList; set => this._offerIdsList = value; } /// Backing field for property. private string _operation; @@ -28,11 +28,11 @@ public partial class TransferOffersDetails : public string Operation { get => this._operation; set => this._operation = value; } /// Backing field for property. - private string[] _targetCollection; + private System.Collections.Generic.List _targetCollection; /// Target collections ids [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public string[] TargetCollection { get => this._targetCollection; set => this._targetCollection = value; } + public System.Collections.Generic.List TargetCollection { get => this._targetCollection; set => this._targetCollection = value; } /// Creates an new instance. public TransferOffersDetails() @@ -48,14 +48,20 @@ public partial interface ITransferOffersDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Offers ids list to transfer from source collection to target collection(s)", SerializedName = @"offerIdsList", PossibleTypes = new [] { typeof(string) })] - string[] OfferIdsList { get; set; } + System.Collections.Generic.List OfferIdsList { get; set; } /// Operation to perform (For example: Copy or Move) [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Operation to perform (For example: Copy or Move)", SerializedName = @"operation", PossibleTypes = new [] { typeof(string) })] @@ -64,10 +70,13 @@ public partial interface ITransferOffersDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Target collections ids", SerializedName = @"targetCollections", PossibleTypes = new [] { typeof(string) })] - string[] TargetCollection { get; set; } + System.Collections.Generic.List TargetCollection { get; set; } } /// Transfer offers response details @@ -75,11 +84,11 @@ internal partial interface ITransferOffersDetailsInternal { /// Offers ids list to transfer from source collection to target collection(s) - string[] OfferIdsList { get; set; } + System.Collections.Generic.List OfferIdsList { get; set; } /// Operation to perform (For example: Copy or Move) string Operation { get; set; } /// Target collections ids - string[] TargetCollection { get; set; } + System.Collections.Generic.List TargetCollection { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersDetails.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersDetails.json.cs similarity index 85% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersDetails.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersDetails.json.cs index acaa3bf546e0..3d2969e23f71 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersDetails.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersDetails.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class TransferOffersDetails partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class TransferOffersDetails /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class TransferOffersDetails /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class TransferOffersDetails partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetails. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetails. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetails. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetails. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new TransferOffersDetails(json) : null; } @@ -117,9 +119,9 @@ internal TransferOffersDetails(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Ru { return; } - {_targetCollection = If( json?.PropertyT("targetCollections"), out var __jsonTargetCollections) ? If( __jsonTargetCollections as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : TargetCollection;} - {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)Operation;} - {_offerIdsList = If( json?.PropertyT("offerIdsList"), out var __jsonOfferIdsList) ? If( __jsonOfferIdsList as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : OfferIdsList;} + {_targetCollection = If( json?.PropertyT("targetCollections"), out var __jsonTargetCollections) ? If( __jsonTargetCollections as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _targetCollection;} + {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)_operation;} + {_offerIdsList = If( json?.PropertyT("offerIdsList"), out var __jsonOfferIdsList) ? If( __jsonOfferIdsList as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : _offerIdsList;} AfterFromJson(json); } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersProperties.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersProperties.PowerShell.cs similarity index 62% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersProperties.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersProperties.PowerShell.cs index a318962e7ce3..86c0c0fc8251 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersProperties.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersProperties.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class TransferOffersProperties /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class TransferOffersProperties /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,29 +55,35 @@ public partial class TransferOffersProperties partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new TransferOffersProperties(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new TransferOffersProperties(content); } @@ -84,16 +92,28 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -108,25 +128,25 @@ internal TransferOffersProperties(global::System.Collections.IDictionary content // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.TransferOffersDetailsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.TransferOffersDetailsTypeConverter.ConvertFrom); } if (content.Contains("TargetCollection")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersPropertiesInternal)this).TargetCollection = (string[]) content.GetValueForProperty("TargetCollection",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersPropertiesInternal)this).TargetCollection, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersPropertiesInternal)this).TargetCollection = (System.Collections.Generic.List) content.GetValueForProperty("TargetCollection",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersPropertiesInternal)this).TargetCollection, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("Operation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersPropertiesInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersPropertiesInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersPropertiesInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersPropertiesInternal)this).Operation, global::System.Convert.ToString); } if (content.Contains("OfferIdsList")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersPropertiesInternal)this).OfferIdsList = (string[]) content.GetValueForProperty("OfferIdsList",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersPropertiesInternal)this).OfferIdsList, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersPropertiesInternal)this).OfferIdsList = (System.Collections.Generic.List) content.GetValueForProperty("OfferIdsList",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersPropertiesInternal)this).OfferIdsList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -141,19 +161,19 @@ internal TransferOffersProperties(global::System.Management.Automation.PSObject // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.TransferOffersDetailsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.TransferOffersDetailsTypeConverter.ConvertFrom); } if (content.Contains("TargetCollection")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersPropertiesInternal)this).TargetCollection = (string[]) content.GetValueForProperty("TargetCollection",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersPropertiesInternal)this).TargetCollection, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersPropertiesInternal)this).TargetCollection = (System.Collections.Generic.List) content.GetValueForProperty("TargetCollection",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersPropertiesInternal)this).TargetCollection, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } if (content.Contains("Operation")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersPropertiesInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersPropertiesInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersPropertiesInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersPropertiesInternal)this).Operation, global::System.Convert.ToString); } if (content.Contains("OfferIdsList")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersPropertiesInternal)this).OfferIdsList = (string[]) content.GetValueForProperty("OfferIdsList",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersPropertiesInternal)this).OfferIdsList, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersPropertiesInternal)this).OfferIdsList = (System.Collections.Generic.List) content.GetValueForProperty("OfferIdsList",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersPropertiesInternal)this).OfferIdsList, __y => TypeConverterExtensions.SelectToList(__y, global::System.Convert.ToString)); } AfterDeserializePSObject(content); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersProperties.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersProperties.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersProperties.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersProperties.TypeConverter.cs index 317c03ecf166..c45022c94859 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersProperties.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersProperties.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class TransferOffersPropertiesTypeConverter : global::System.Mana { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersProperties.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersProperties.cs similarity index 60% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersProperties.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersProperties.cs index bcc44aff1313..0c949e4c241b 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersProperties.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersProperties.cs @@ -3,37 +3,37 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Transfer offers properties public partial class TransferOffersProperties : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersPropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersPropertiesInternal { /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetails Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersPropertiesInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.TransferOffersDetails()); set { {_property = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetails Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersPropertiesInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.TransferOffersDetails()); set { {_property = value;} } } /// Offers ids list to transfer from source collection to target collection(s) [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string[] OfferIdsList { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetailsInternal)Property).OfferIdsList; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetailsInternal)Property).OfferIdsList = value ?? null /* arrayOf */; } + public System.Collections.Generic.List OfferIdsList { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetailsInternal)Property).OfferIdsList; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetailsInternal)Property).OfferIdsList = value ?? null /* arrayOf */; } /// Operation to perform (For example: Copy or Move) [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string Operation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetailsInternal)Property).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetailsInternal)Property).Operation = value ?? null; } + public string Operation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetailsInternal)Property).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetailsInternal)Property).Operation = value ?? null; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetails _property; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetails _property; /// transfer offers properties details [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetails Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.TransferOffersDetails()); set => this._property = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetails Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.TransferOffersDetails()); set => this._property = value; } /// Target collections ids [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string[] TargetCollection { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetailsInternal)Property).TargetCollection; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetailsInternal)Property).TargetCollection = value ?? null /* arrayOf */; } + public System.Collections.Generic.List TargetCollection { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetailsInternal)Property).TargetCollection; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetailsInternal)Property).TargetCollection = value ?? null /* arrayOf */; } /// Creates an new instance. public TransferOffersProperties() @@ -49,14 +49,20 @@ public partial interface ITransferOffersProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Offers ids list to transfer from source collection to target collection(s)", SerializedName = @"offerIdsList", PossibleTypes = new [] { typeof(string) })] - string[] OfferIdsList { get; set; } + System.Collections.Generic.List OfferIdsList { get; set; } /// Operation to perform (For example: Copy or Move) [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Operation to perform (For example: Copy or Move)", SerializedName = @"operation", PossibleTypes = new [] { typeof(string) })] @@ -65,10 +71,13 @@ public partial interface ITransferOffersProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Target collections ids", SerializedName = @"targetCollections", PossibleTypes = new [] { typeof(string) })] - string[] TargetCollection { get; set; } + System.Collections.Generic.List TargetCollection { get; set; } } /// Transfer offers properties @@ -76,13 +85,13 @@ internal partial interface ITransferOffersPropertiesInternal { /// Offers ids list to transfer from source collection to target collection(s) - string[] OfferIdsList { get; set; } + System.Collections.Generic.List OfferIdsList { get; set; } /// Operation to perform (For example: Copy or Move) string Operation { get; set; } /// transfer offers properties details - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersDetails Property { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersDetails Property { get; set; } /// Target collections ids - string[] TargetCollection { get; set; } + System.Collections.Generic.List TargetCollection { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersProperties.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersProperties.json.cs similarity index 88% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersProperties.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersProperties.json.cs index 1d85b04def74..b3651726024d 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersProperties.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersProperties.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class TransferOffersProperties partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class TransferOffersProperties /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class TransferOffersProperties /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class TransferOffersProperties partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new TransferOffersProperties(json) : null; } @@ -99,7 +101,7 @@ internal TransferOffersProperties(Microsoft.Azure.PowerShell.Cmdlets.Marketplace { return; } - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.TransferOffersDetails.FromJson(__jsonProperties) : Property;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.TransferOffersDetails.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersResponse.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersResponse.PowerShell.cs similarity index 64% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersResponse.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersResponse.PowerShell.cs index b4178b70f794..9c8f8949d358 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersResponse.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersResponse.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -34,7 +34,8 @@ public partial class TransferOffersResponse /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -46,7 +47,8 @@ public partial class TransferOffersResponse /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -56,27 +58,35 @@ public partial class TransferOffersResponse partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new TransferOffersResponse(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new TransferOffersResponse(content); } @@ -85,16 +95,28 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -109,17 +131,17 @@ internal TransferOffersResponse(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Succeeded")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponseInternal)this).Succeeded = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[]) content.GetValueForProperty("Succeeded",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponseInternal)this).Succeeded, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponseInternal)this).Succeeded = (System.Collections.Generic.List) content.GetValueForProperty("Succeeded",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponseInternal)this).Succeeded, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsDetailsTypeConverter.ConvertFrom)); } if (content.Contains("Failed")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponseInternal)this).Failed = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[]) content.GetValueForProperty("Failed",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponseInternal)this).Failed, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponseInternal)this).Failed = (System.Collections.Generic.List) content.GetValueForProperty("Failed",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponseInternal)this).Failed, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsDetailsTypeConverter.ConvertFrom)); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -134,11 +156,11 @@ internal TransferOffersResponse(global::System.Management.Automation.PSObject co // actually deserialize if (content.Contains("Succeeded")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponseInternal)this).Succeeded = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[]) content.GetValueForProperty("Succeeded",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponseInternal)this).Succeeded, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponseInternal)this).Succeeded = (System.Collections.Generic.List) content.GetValueForProperty("Succeeded",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponseInternal)this).Succeeded, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsDetailsTypeConverter.ConvertFrom)); } if (content.Contains("Failed")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponseInternal)this).Failed = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[]) content.GetValueForProperty("Failed",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponseInternal)this).Failed, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsDetailsTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponseInternal)this).Failed = (System.Collections.Generic.List) content.GetValueForProperty("Failed",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponseInternal)this).Failed, __y => TypeConverterExtensions.SelectToList(__y, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsDetailsTypeConverter.ConvertFrom)); } AfterDeserializePSObject(content); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersResponse.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersResponse.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersResponse.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersResponse.TypeConverter.cs index 7729a0d08e75..ff0493920d90 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersResponse.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersResponse.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class TransferOffersResponseTypeConverter : global::System.Manage { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersResponse.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersResponse.cs similarity index 60% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersResponse.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersResponse.cs index 2c18413e069d..cd56a573fad3 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersResponse.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersResponse.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -12,23 +12,23 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 /// or failed /// public partial class TransferOffersResponse : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponseInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponseInternal { /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[] _failed; + private System.Collections.Generic.List _failed; /// Failed collections [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[] Failed { get => this._failed; set => this._failed = value; } + public System.Collections.Generic.List Failed { get => this._failed; set => this._failed = value; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[] _succeeded; + private System.Collections.Generic.List _succeeded; /// Succeeded collections [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[] Succeeded { get => this._succeeded; set => this._succeeded = value; } + public System.Collections.Generic.List Succeeded { get => this._succeeded; set => this._succeeded = value; } /// Creates an new instance. public TransferOffersResponse() @@ -45,18 +45,24 @@ public partial interface ITransferOffersResponse : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Failed collections", SerializedName = @"failed", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[] Failed { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetails) })] + System.Collections.Generic.List Failed { get; set; } /// Succeeded collections [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Succeeded collections", SerializedName = @"succeeded", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails) })] - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[] Succeeded { get; set; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetails) })] + System.Collections.Generic.List Succeeded { get; set; } } /// The transfer items response. The response contains two lists that indicate for each collection whether the operation succeeded @@ -65,9 +71,9 @@ internal partial interface ITransferOffersResponseInternal { /// Failed collections - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[] Failed { get; set; } + System.Collections.Generic.List Failed { get; set; } /// Succeeded collections - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails[] Succeeded { get; set; } + System.Collections.Generic.List Succeeded { get; set; } } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersResponse.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersResponse.json.cs similarity index 82% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersResponse.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersResponse.json.cs index 95fdf21e322b..3e4bd6a92725 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/TransferOffersResponse.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/TransferOffersResponse.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -23,7 +23,7 @@ public partial class TransferOffersResponse partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -33,7 +33,8 @@ public partial class TransferOffersResponse /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -45,7 +46,8 @@ public partial class TransferOffersResponse /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -55,13 +57,13 @@ public partial class TransferOffersResponse partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new TransferOffersResponse(json) : null; } @@ -119,8 +121,8 @@ internal TransferOffersResponse(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.R { return; } - {_succeeded = If( json?.PropertyT("succeeded"), out var __jsonSucceeded) ? If( __jsonSucceeded as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsDetails.FromJson(__u) )) ))() : null : Succeeded;} - {_failed = If( json?.PropertyT("failed"), out var __jsonFailed) ? If( __jsonFailed as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsDetails.FromJson(__p) )) ))() : null : Failed;} + {_succeeded = If( json?.PropertyT("succeeded"), out var __jsonSucceeded) ? If( __jsonSucceeded as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsDetails.FromJson(__u) )) ))() : null : _succeeded;} + {_failed = If( json?.PropertyT("failed"), out var __jsonFailed) ? If( __jsonFailed as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonArray, out var __q) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsDetails) (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsDetails.FromJson(__p) )) ))() : null : _failed;} AfterFromJson(json); } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/UserRequestDetails.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/UserRequestDetails.PowerShell.cs similarity index 64% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/UserRequestDetails.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/UserRequestDetails.PowerShell.cs index 34ae83e36b17..290d90368772 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/UserRequestDetails.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/UserRequestDetails.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class UserRequestDetails /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class UserRequestDetails /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,27 +55,35 @@ public partial class UserRequestDetails partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new UserRequestDetails(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new UserRequestDetails(content); } @@ -82,16 +92,28 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -106,29 +128,29 @@ internal UserRequestDetails(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("User")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).User = (string) content.GetValueForProperty("User",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).User, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).User = (string) content.GetValueForProperty("User",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).User, global::System.Convert.ToString); } if (content.Contains("Date")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).Date = (string) content.GetValueForProperty("Date",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).Date, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).Date = (string) content.GetValueForProperty("Date",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).Date, global::System.Convert.ToString); } if (content.Contains("Justification")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).Justification = (string) content.GetValueForProperty("Justification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).Justification, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).Justification = (string) content.GetValueForProperty("Justification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).Justification, global::System.Convert.ToString); } if (content.Contains("SubscriptionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).SubscriptionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).SubscriptionId, global::System.Convert.ToString); } if (content.Contains("SubscriptionName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).SubscriptionName = (string) content.GetValueForProperty("SubscriptionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).SubscriptionName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).SubscriptionName = (string) content.GetValueForProperty("SubscriptionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).SubscriptionName, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -143,23 +165,23 @@ internal UserRequestDetails(global::System.Management.Automation.PSObject conten // actually deserialize if (content.Contains("User")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).User = (string) content.GetValueForProperty("User",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).User, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).User = (string) content.GetValueForProperty("User",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).User, global::System.Convert.ToString); } if (content.Contains("Date")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).Date = (string) content.GetValueForProperty("Date",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).Date, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).Date = (string) content.GetValueForProperty("Date",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).Date, global::System.Convert.ToString); } if (content.Contains("Justification")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).Justification = (string) content.GetValueForProperty("Justification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).Justification, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).Justification = (string) content.GetValueForProperty("Justification",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).Justification, global::System.Convert.ToString); } if (content.Contains("SubscriptionId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).SubscriptionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).SubscriptionId, global::System.Convert.ToString); } if (content.Contains("SubscriptionName")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).SubscriptionName = (string) content.GetValueForProperty("SubscriptionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal)this).SubscriptionName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).SubscriptionName = (string) content.GetValueForProperty("SubscriptionName",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal)this).SubscriptionName, global::System.Convert.ToString); } AfterDeserializePSObject(content); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/UserRequestDetails.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/UserRequestDetails.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/UserRequestDetails.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/UserRequestDetails.TypeConverter.cs index ba0881e7fe0f..2c740c4693f5 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/UserRequestDetails.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/UserRequestDetails.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class UserRequestDetailsTypeConverter : global::System.Management { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetails ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetails ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetails).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetails).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/UserRequestDetails.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/UserRequestDetails.cs similarity index 87% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/UserRequestDetails.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/UserRequestDetails.cs index 04649136afc5..294de2b5f583 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/UserRequestDetails.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/UserRequestDetails.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// user request details public partial class UserRequestDetails : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetails, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetails, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal { /// Backing field for property. @@ -28,13 +28,13 @@ public partial class UserRequestDetails : public string Justification { get => this._justification; } /// Internal Acessors for Date - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal.Date { get => this._date; set { {_date = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal.Date { get => this._date; set { {_date = value;} } } /// Internal Acessors for Justification - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal.Justification { get => this._justification; set { {_justification = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal.Justification { get => this._justification; set { {_justification = value;} } } /// Internal Acessors for User - string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetailsInternal.User { get => this._user; set { {_user = value;} } } + string Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetailsInternal.User { get => this._user; set { {_user = value;} } } /// Backing field for property. private string _subscriptionId; @@ -71,6 +71,9 @@ public partial interface IUserRequestDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets request date", SerializedName = @"date", PossibleTypes = new [] { typeof(string) })] @@ -79,6 +82,9 @@ public partial interface IUserRequestDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets justification", SerializedName = @"justification", PossibleTypes = new [] { typeof(string) })] @@ -87,6 +93,9 @@ public partial interface IUserRequestDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets the subscription id that the user is requesting to add the plan to", SerializedName = @"subscriptionId", PossibleTypes = new [] { typeof(string) })] @@ -95,6 +104,9 @@ public partial interface IUserRequestDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets the subscription name that the user is requesting to add the plan to", SerializedName = @"subscriptionName", PossibleTypes = new [] { typeof(string) })] @@ -103,6 +115,9 @@ public partial interface IUserRequestDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = true, + Read = true, + Create = false, + Update = false, Description = @"Gets user id", SerializedName = @"user", PossibleTypes = new [] { typeof(string) })] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/UserRequestDetails.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/UserRequestDetails.json.cs similarity index 88% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/UserRequestDetails.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/UserRequestDetails.json.cs index d2796a868f2c..cb8ff3dd30ef 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/UserRequestDetails.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/UserRequestDetails.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class UserRequestDetails partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class UserRequestDetails /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class UserRequestDetails /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class UserRequestDetails partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetails. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetails. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetails. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetails. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IUserRequestDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IUserRequestDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new UserRequestDetails(json) : null; } @@ -82,15 +84,15 @@ public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode ToJs { return container; } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._user)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._user.ToString()) : null, "user" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._date)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._date.ToString()) : null, "date" ,container.Add ); } - if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeReadOnly)) + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._justification)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonString(this._justification.ToString()) : null, "justification" ,container.Add ); } @@ -112,11 +114,11 @@ internal UserRequestDetails(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runti { return; } - {_user = If( json?.PropertyT("user"), out var __jsonUser) ? (string)__jsonUser : (string)User;} - {_date = If( json?.PropertyT("date"), out var __jsonDate) ? (string)__jsonDate : (string)Date;} - {_justification = If( json?.PropertyT("justification"), out var __jsonJustification) ? (string)__jsonJustification : (string)Justification;} - {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} - {_subscriptionName = If( json?.PropertyT("subscriptionName"), out var __jsonSubscriptionName) ? (string)__jsonSubscriptionName : (string)SubscriptionName;} + {_user = If( json?.PropertyT("user"), out var __jsonUser) ? (string)__jsonUser : (string)_user;} + {_date = If( json?.PropertyT("date"), out var __jsonDate) ? (string)__jsonDate : (string)_date;} + {_justification = If( json?.PropertyT("justification"), out var __jsonJustification) ? (string)__jsonJustification : (string)_justification;} + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)_subscriptionId;} + {_subscriptionName = If( json?.PropertyT("subscriptionName"), out var __jsonSubscriptionName) ? (string)__jsonSubscriptionName : (string)_subscriptionName;} AfterFromJson(json); } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawDetails.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawDetails.PowerShell.cs similarity index 71% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawDetails.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawDetails.PowerShell.cs index 8d7a0bd4a2bf..99ef44aa7879 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawDetails.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawDetails.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class WithdrawDetails /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class WithdrawDetails /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,27 +55,35 @@ public partial class WithdrawDetails partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new WithdrawDetails(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new WithdrawDetails(content); } @@ -82,16 +92,28 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -106,17 +128,17 @@ internal WithdrawDetails(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetailsInternal)this).PlanId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetailsInternal)this).PlanId, global::System.Convert.ToString); } if (content.Contains("PublisherId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetailsInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetailsInternal)this).PublisherId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetailsInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetailsInternal)this).PublisherId, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -131,11 +153,11 @@ internal WithdrawDetails(global::System.Management.Automation.PSObject content) // actually deserialize if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetailsInternal)this).PlanId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetailsInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetailsInternal)this).PlanId, global::System.Convert.ToString); } if (content.Contains("PublisherId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetailsInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetailsInternal)this).PublisherId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetailsInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetailsInternal)this).PublisherId, global::System.Convert.ToString); } AfterDeserializePSObject(content); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawDetails.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawDetails.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawDetails.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawDetails.TypeConverter.cs index 4b237ca2dde2..7fade1bf907b 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawDetails.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawDetails.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class WithdrawDetailsTypeConverter : global::System.Management.Au { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetails ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetails ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetails).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetails).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawDetails.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawDetails.cs similarity index 87% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawDetails.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawDetails.cs index 2973b7d908e8..a75a7f88ca6e 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawDetails.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawDetails.cs @@ -3,14 +3,14 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Withdraw properties details public partial class WithdrawDetails : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetails, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetailsInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetails, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetailsInternal { /// Backing field for property. @@ -41,6 +41,9 @@ public partial interface IWithdrawDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets Plan Id ", SerializedName = @"planId", PossibleTypes = new [] { typeof(string) })] @@ -49,6 +52,9 @@ public partial interface IWithdrawDetails : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The offer's publisher id", SerializedName = @"publisherId", PossibleTypes = new [] { typeof(string) })] diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawDetails.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawDetails.json.cs similarity index 89% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawDetails.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawDetails.json.cs index 34bfbef037d2..8c18966cae7c 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawDetails.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawDetails.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class WithdrawDetails partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class WithdrawDetails /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class WithdrawDetails /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class WithdrawDetails partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetails. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetails. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetails. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetails. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new WithdrawDetails(json) : null; } @@ -100,8 +102,8 @@ internal WithdrawDetails(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime. { return; } - {_planId = If( json?.PropertyT("planId"), out var __jsonPlanId) ? (string)__jsonPlanId : (string)PlanId;} - {_publisherId = If( json?.PropertyT("publisherId"), out var __jsonPublisherId) ? (string)__jsonPublisherId : (string)PublisherId;} + {_planId = If( json?.PropertyT("planId"), out var __jsonPlanId) ? (string)__jsonPlanId : (string)_planId;} + {_publisherId = If( json?.PropertyT("publisherId"), out var __jsonPublisherId) ? (string)__jsonPublisherId : (string)_publisherId;} AfterFromJson(json); } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawProperties.PowerShell.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawProperties.PowerShell.cs similarity index 66% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawProperties.PowerShell.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawProperties.PowerShell.cs index 6e9219a538a4..ea9d9cdf4e75 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawProperties.PowerShell.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawProperties.PowerShell.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -31,7 +31,8 @@ public partial class WithdrawProperties /// /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Collections.IDictionary content that should be used. @@ -43,7 +44,8 @@ public partial class WithdrawProperties /// /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization /// of the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -53,27 +55,35 @@ public partial class WithdrawProperties partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); /// - /// Deserializes a into an instance of OverrideToString will be called if it is implemented. Implement this method in a partial class to enable this behavior + /// + /// /// instance serialized to a string, normally it is a Json + /// /// set returnNow to true if you provide a customized OverrideToString function + + partial void OverrideToString(ref string stringResult, ref bool returnNow); + + /// + /// Deserializes a into an instance of . /// /// The global::System.Collections.IDictionary content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) { return new WithdrawProperties(content); } /// - /// Deserializes a into an instance of into an instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. /// - /// an instance of . + /// an instance of . /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) { return new WithdrawProperties(content); } @@ -82,16 +92,28 @@ public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601. /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); /// Serializes this instance to a json string. /// a containing this model serialized to JSON text. public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeAll)?.ToString(); + public override string ToString() + { + var returnNow = false; + var result = global::System.String.Empty; + OverrideToString(ref result, ref returnNow); + if (returnNow) + { + return result; + } + return ToJsonString(); + } + /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Collections.IDictionary content that should be used. @@ -106,21 +128,21 @@ internal WithdrawProperties(global::System.Collections.IDictionary content) // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.WithdrawDetailsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.WithdrawDetailsTypeConverter.ConvertFrom); } if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawPropertiesInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawPropertiesInternal)this).PlanId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawPropertiesInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawPropertiesInternal)this).PlanId, global::System.Convert.ToString); } if (content.Contains("PublisherId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawPropertiesInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawPropertiesInternal)this).PublisherId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawPropertiesInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawPropertiesInternal)this).PublisherId, global::System.Convert.ToString); } AfterDeserializeDictionary(content); } /// - /// Deserializes a into a new instance of into a new instance of . /// /// The global::System.Management.Automation.PSObject content that should be used. @@ -135,15 +157,15 @@ internal WithdrawProperties(global::System.Management.Automation.PSObject conten // actually deserialize if (content.Contains("Property")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.WithdrawDetailsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawPropertiesInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawPropertiesInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.WithdrawDetailsTypeConverter.ConvertFrom); } if (content.Contains("PlanId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawPropertiesInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawPropertiesInternal)this).PlanId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawPropertiesInternal)this).PlanId = (string) content.GetValueForProperty("PlanId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawPropertiesInternal)this).PlanId, global::System.Convert.ToString); } if (content.Contains("PublisherId")) { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawPropertiesInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawPropertiesInternal)this).PublisherId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawPropertiesInternal)this).PublisherId = (string) content.GetValueForProperty("PublisherId",((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawPropertiesInternal)this).PublisherId, global::System.Convert.ToString); } AfterDeserializePSObject(content); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawProperties.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawProperties.TypeConverter.cs similarity index 81% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawProperties.TypeConverter.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawProperties.TypeConverter.cs index d5798116a6d1..00fae62d5a0a 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawProperties.TypeConverter.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawProperties.TypeConverter.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; @@ -14,20 +14,20 @@ public partial class WithdrawPropertiesTypeConverter : global::System.Management { /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. + /// true if the converter can convert the parameter to the parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the - /// parameter. + /// Determines if the converter can convert the parameter to the + /// type. /// /// the instance to check if it can be converted to the type. @@ -75,19 +75,20 @@ public static bool CanConvertFrom(dynamic sourceValue) } /// - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the + /// parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false + /// true if the converter can convert the parameter to the parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -99,21 +100,20 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// /// an instance of , or null if there is no suitable conversion. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawProperties ConvertFrom(dynamic sourceValue) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawProperties ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return null; } global::System.Type type = sourceValue.GetType(); - if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawProperties).IsAssignableFrom(type)) + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawProperties).IsAssignableFrom(type)) { return sourceValue; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawProperties.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawProperties.cs similarity index 66% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawProperties.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawProperties.cs index cd54f6b25c68..28df6512a24e 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawProperties.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawProperties.cs @@ -3,33 +3,33 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; /// Withdraw properties public partial class WithdrawProperties : - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawProperties, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawPropertiesInternal + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawProperties, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawPropertiesInternal { /// Internal Acessors for Property - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetails Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawPropertiesInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.WithdrawDetails()); set { {_property = value;} } } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetails Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawPropertiesInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.WithdrawDetails()); set { {_property = value;} } } /// Gets or sets Plan Id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string PlanId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetailsInternal)Property).PlanId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetailsInternal)Property).PlanId = value ?? null; } + public string PlanId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetailsInternal)Property).PlanId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetailsInternal)Property).PlanId = value ?? null; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetails _property; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetails _property; /// Withdraw properties details [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Owned)] - internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetails Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.WithdrawDetails()); set => this._property = value; } + internal Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetails Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.WithdrawDetails()); set => this._property = value; } /// The offer's publisher id [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Origin(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PropertyOrigin.Inlined)] - public string PublisherId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetailsInternal)Property).PublisherId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetailsInternal)Property).PublisherId = value ?? null; } + public string PublisherId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetailsInternal)Property).PublisherId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetailsInternal)Property).PublisherId = value ?? null; } /// Creates an new instance. public WithdrawProperties() @@ -45,6 +45,9 @@ public partial interface IWithdrawProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"Gets or sets Plan Id ", SerializedName = @"planId", PossibleTypes = new [] { typeof(string) })] @@ -53,6 +56,9 @@ public partial interface IWithdrawProperties : [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( Required = false, ReadOnly = false, + Read = true, + Create = true, + Update = true, Description = @"The offer's publisher id", SerializedName = @"publisherId", PossibleTypes = new [] { typeof(string) })] @@ -66,7 +72,7 @@ internal partial interface IWithdrawPropertiesInternal /// Gets or sets Plan Id string PlanId { get; set; } /// Withdraw properties details - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawDetails Property { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawDetails Property { get; set; } /// The offer's publisher id string PublisherId { get; set; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawProperties.json.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawProperties.json.cs similarity index 88% rename from src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawProperties.json.cs rename to src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawProperties.json.cs index 99668ad1c153..cd62f3788dc5 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Models/Api20210601/WithdrawProperties.json.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/api/Models/WithdrawProperties.json.cs @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601 +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; @@ -20,7 +20,7 @@ public partial class WithdrawProperties partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json); /// - /// AfterToJson will be called after the json erialization has finished, allowing customization of the AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior /// /// The JSON container that the serialization result will be placed in. @@ -30,7 +30,8 @@ public partial class WithdrawProperties /// /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. - /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JsonNode that should be deserialized into this object. @@ -42,7 +43,8 @@ public partial class WithdrawProperties /// /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. - /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. /// Implement this method in a partial class to enable this behavior. /// /// The JSON container that the serialization result will be placed in. @@ -52,13 +54,13 @@ public partial class WithdrawProperties partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject container, ref bool returnNow); /// - /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawProperties. + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawProperties. /// /// a to deserialize from. /// - /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawProperties. + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawProperties. /// - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IWithdrawProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) + public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IWithdrawProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonObject json ? new WithdrawProperties(json) : null; } @@ -99,7 +101,7 @@ internal WithdrawProperties(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runti { return; } - {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.WithdrawDetails.FromJson(__jsonProperties) : Property;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.WithdrawDetails.FromJson(__jsonProperties) : _property;} AfterFromJson(json); } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Accessibility.Completer.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Support/Accessibility.Completer.cs deleted file mode 100644 index 1dddac205336..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Accessibility.Completer.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support -{ - - /// Plan accessibility - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AccessibilityTypeConverter))] - public partial struct Accessibility : - System.Management.Automation.IArgumentCompleter - { - - /// - /// Implementations of this function are called by PowerShell to complete arguments. - /// - /// The name of the command that needs argument completion. - /// The name of the parameter that needs argument completion. - /// The (possibly empty) word being completed. - /// The command ast in case it is needed for completion. - /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot - /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. - /// - /// A collection of completion results, most like with ResultType set to ParameterValue. - /// - public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) - { - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Unknown".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Unknown'", "Unknown", global::System.Management.Automation.CompletionResultType.ParameterValue, "Unknown"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Public".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Public'", "Public", global::System.Management.Automation.CompletionResultType.ParameterValue, "Public"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "PrivateTenantOnLevel".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'PrivateTenantOnLevel'", "PrivateTenantOnLevel", global::System.Management.Automation.CompletionResultType.ParameterValue, "PrivateTenantOnLevel"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "PrivateSubscriptionOnLevel".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'PrivateSubscriptionOnLevel'", "PrivateSubscriptionOnLevel", global::System.Management.Automation.CompletionResultType.ParameterValue, "PrivateSubscriptionOnLevel"); - } - } - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Accessibility.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Support/Accessibility.TypeConverter.cs deleted file mode 100644 index bfa0e6962750..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Accessibility.TypeConverter.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support -{ - - /// Plan accessibility - public partial class AccessibilityTypeConverter : - global::System.Management.Automation.PSTypeConverter - { - - /// - /// Determines if the converter can convert the parameter to the - /// parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. - /// - public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; - - /// - /// Determines if the converter can convert the parameter to the - /// parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. - /// - public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; - - /// - /// Converts the parameter to the parameter using and - /// - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// - /// an instance of , or null if there is no suitable conversion. - /// - public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => Accessibility.CreateFrom(sourceValue); - - /// NotImplemented -- this will return null - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// will always return null. - public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Accessibility.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Support/Accessibility.cs deleted file mode 100644 index 6745c6776f87..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Accessibility.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support -{ - - /// Plan accessibility - public partial struct Accessibility : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Accessibility PrivateSubscriptionOnLevel = @"PrivateSubscriptionOnLevel"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Accessibility PrivateTenantOnLevel = @"PrivateTenantOnLevel"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Accessibility Public = @"Public"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Accessibility Unknown = @"Unknown"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Creates an instance of the - /// the value to create an instance for. - private Accessibility(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Conversion from arbitrary object to Accessibility - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new Accessibility(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type Accessibility - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Accessibility e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type Accessibility (override for Object) - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public override bool Equals(object obj) - { - return obj is Accessibility && Equals((Accessibility)obj); - } - - /// Returns hashCode for enum Accessibility - /// The hashCode of the value - public override int GetHashCode() - { - return this._value.GetHashCode(); - } - - /// Returns string representation for Accessibility - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to Accessibility - /// the value to convert to an instance of . - - public static implicit operator Accessibility(string value) - { - return new Accessibility(value); - } - - /// Implicit operator to convert Accessibility to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Accessibility e) - { - return e._value; - } - - /// Overriding != operator for enum Accessibility - /// the value to compare against - /// the value to compare against - /// true if the two instances are not equal to the same value - public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Accessibility e1, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Accessibility e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum Accessibility - /// the value to compare against - /// the value to compare against - /// true if the two instances are equal to the same value - public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Accessibility e1, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Accessibility e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Support/AdminAction.Completer.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Support/AdminAction.Completer.cs deleted file mode 100644 index cdd026373f77..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Support/AdminAction.Completer.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support -{ - - /// Gets or sets admin action - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminActionTypeConverter))] - public partial struct AdminAction : - System.Management.Automation.IArgumentCompleter - { - - /// - /// Implementations of this function are called by PowerShell to complete arguments. - /// - /// The name of the command that needs argument completion. - /// The name of the parameter that needs argument completion. - /// The (possibly empty) word being completed. - /// The command ast in case it is needed for completion. - /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot - /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. - /// - /// A collection of completion results, most like with ResultType set to ParameterValue. - /// - public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) - { - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Approved".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Approved'", "Approved", global::System.Management.Automation.CompletionResultType.ParameterValue, "Approved"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Rejected".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Rejected'", "Rejected", global::System.Management.Automation.CompletionResultType.ParameterValue, "Rejected"); - } - } - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Support/AdminAction.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Support/AdminAction.TypeConverter.cs deleted file mode 100644 index 013ca5c809c0..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Support/AdminAction.TypeConverter.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support -{ - - /// Gets or sets admin action - public partial class AdminActionTypeConverter : - global::System.Management.Automation.PSTypeConverter - { - - /// - /// Determines if the converter can convert the parameter to the - /// parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. - /// - public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; - - /// - /// Determines if the converter can convert the parameter to the - /// parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. - /// - public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; - - /// - /// Converts the parameter to the parameter using and - /// - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// - /// an instance of , or null if there is no suitable conversion. - /// - public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => AdminAction.CreateFrom(sourceValue); - - /// NotImplemented -- this will return null - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// will always return null. - public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Support/AdminAction.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Support/AdminAction.cs deleted file mode 100644 index 60b4f32b7d62..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Support/AdminAction.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support -{ - - /// Gets or sets admin action - public partial struct AdminAction : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction Approved = @"Approved"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction Rejected = @"Rejected"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Creates an instance of the - /// the value to create an instance for. - private AdminAction(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Conversion from arbitrary object to AdminAction - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new AdminAction(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type AdminAction - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type AdminAction (override for Object) - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public override bool Equals(object obj) - { - return obj is AdminAction && Equals((AdminAction)obj); - } - - /// Returns hashCode for enum AdminAction - /// The hashCode of the value - public override int GetHashCode() - { - return this._value.GetHashCode(); - } - - /// Returns string representation for AdminAction - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to AdminAction - /// the value to convert to an instance of . - - public static implicit operator AdminAction(string value) - { - return new AdminAction(value); - } - - /// Implicit operator to convert AdminAction to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction e) - { - return e._value; - } - - /// Overriding != operator for enum AdminAction - /// the value to compare against - /// the value to compare against - /// true if the two instances are not equal to the same value - public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction e1, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum AdminAction - /// the value to compare against - /// the value to compare against - /// true if the two instances are equal to the same value - public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction e1, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AdminAction e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Availability.Completer.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Support/Availability.Completer.cs deleted file mode 100644 index b8e8c2878e00..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Availability.Completer.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support -{ - - /// Indicates private store availability - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.AvailabilityTypeConverter))] - public partial struct Availability : - System.Management.Automation.IArgumentCompleter - { - - /// - /// Implementations of this function are called by PowerShell to complete arguments. - /// - /// The name of the command that needs argument completion. - /// The name of the parameter that needs argument completion. - /// The (possibly empty) word being completed. - /// The command ast in case it is needed for completion. - /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot - /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. - /// - /// A collection of completion results, most like with ResultType set to ParameterValue. - /// - public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) - { - if (global::System.String.IsNullOrEmpty(wordToComplete) || "enabled".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'enabled'", "enabled", global::System.Management.Automation.CompletionResultType.ParameterValue, "enabled"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "disabled".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'disabled'", "disabled", global::System.Management.Automation.CompletionResultType.ParameterValue, "disabled"); - } - } - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Availability.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Support/Availability.TypeConverter.cs deleted file mode 100644 index f04356acb1f8..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Availability.TypeConverter.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support -{ - - /// Indicates private store availability - public partial class AvailabilityTypeConverter : - global::System.Management.Automation.PSTypeConverter - { - - /// - /// Determines if the converter can convert the parameter to the - /// parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. - /// - public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; - - /// - /// Determines if the converter can convert the parameter to the - /// parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. - /// - public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; - - /// - /// Converts the parameter to the parameter using and - /// - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// - /// an instance of , or null if there is no suitable conversion. - /// - public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => Availability.CreateFrom(sourceValue); - - /// NotImplemented -- this will return null - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// will always return null. - public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Availability.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Support/Availability.cs deleted file mode 100644 index 1db77d10be63..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Availability.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support -{ - - /// Indicates private store availability - public partial struct Availability : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability Disabled = @"disabled"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability Enabled = @"enabled"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Creates an instance of the - /// the value to create an instance for. - private Availability(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Conversion from arbitrary object to Availability - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new Availability(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type Availability - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type Availability (override for Object) - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public override bool Equals(object obj) - { - return obj is Availability && Equals((Availability)obj); - } - - /// Returns hashCode for enum Availability - /// The hashCode of the value - public override int GetHashCode() - { - return this._value.GetHashCode(); - } - - /// Returns string representation for Availability - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to Availability - /// the value to convert to an instance of . - - public static implicit operator Availability(string value) - { - return new Availability(value); - } - - /// Implicit operator to convert Availability to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability e) - { - return e._value; - } - - /// Overriding != operator for enum Availability - /// the value to compare against - /// the value to compare against - /// true if the two instances are not equal to the same value - public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability e1, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum Availability - /// the value to compare against - /// the value to compare against - /// true if the two instances are equal to the same value - public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability e1, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Support/IdentityType.Completer.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Support/IdentityType.Completer.cs deleted file mode 100644 index af2de0095514..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Support/IdentityType.Completer.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support -{ - - /// The type of identity that creates/modifies resources - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityTypeTypeConverter))] - public partial struct IdentityType : - System.Management.Automation.IArgumentCompleter - { - - /// - /// Implementations of this function are called by PowerShell to complete arguments. - /// - /// The name of the command that needs argument completion. - /// The name of the parameter that needs argument completion. - /// The (possibly empty) word being completed. - /// The command ast in case it is needed for completion. - /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot - /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. - /// - /// A collection of completion results, most like with ResultType set to ParameterValue. - /// - public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) - { - if (global::System.String.IsNullOrEmpty(wordToComplete) || "User".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'User'", "User", global::System.Management.Automation.CompletionResultType.ParameterValue, "User"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Application".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Application'", "Application", global::System.Management.Automation.CompletionResultType.ParameterValue, "Application"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "ManagedIdentity".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'ManagedIdentity'", "ManagedIdentity", global::System.Management.Automation.CompletionResultType.ParameterValue, "ManagedIdentity"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Key".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Key'", "Key", global::System.Management.Automation.CompletionResultType.ParameterValue, "Key"); - } - } - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Support/IdentityType.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Support/IdentityType.TypeConverter.cs deleted file mode 100644 index b0c4ccbb8fca..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Support/IdentityType.TypeConverter.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support -{ - - /// The type of identity that creates/modifies resources - public partial class IdentityTypeTypeConverter : - global::System.Management.Automation.PSTypeConverter - { - - /// - /// Determines if the converter can convert the parameter to the - /// parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. - /// - public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; - - /// - /// Determines if the converter can convert the parameter to the - /// parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. - /// - public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; - - /// - /// Converts the parameter to the parameter using and - /// - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// - /// an instance of , or null if there is no suitable conversion. - /// - public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => IdentityType.CreateFrom(sourceValue); - - /// NotImplemented -- this will return null - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// will always return null. - public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Support/IdentityType.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Support/IdentityType.cs deleted file mode 100644 index 016e4ed4cae1..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Support/IdentityType.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support -{ - - /// The type of identity that creates/modifies resources - public partial struct IdentityType : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType Application = @"Application"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType Key = @"Key"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType ManagedIdentity = @"ManagedIdentity"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType User = @"User"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Conversion from arbitrary object to IdentityType - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new IdentityType(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type IdentityType - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type IdentityType (override for Object) - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public override bool Equals(object obj) - { - return obj is IdentityType && Equals((IdentityType)obj); - } - - /// Returns hashCode for enum IdentityType - /// The hashCode of the value - public override int GetHashCode() - { - return this._value.GetHashCode(); - } - - /// Creates an instance of the - /// the value to create an instance for. - private IdentityType(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Returns string representation for IdentityType - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to IdentityType - /// the value to convert to an instance of . - - public static implicit operator IdentityType(string value) - { - return new IdentityType(value); - } - - /// Implicit operator to convert IdentityType to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType e) - { - return e._value; - } - - /// Overriding != operator for enum IdentityType - /// the value to compare against - /// the value to compare against - /// true if the two instances are not equal to the same value - public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType e1, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum IdentityType - /// the value to compare against - /// the value to compare against - /// true if the two instances are equal to the same value - public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType e1, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.IdentityType e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Operation.Completer.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Support/Operation.Completer.cs deleted file mode 100644 index f82d2b14ab1e..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Operation.Completer.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support -{ - - /// Set the Operation for the POST method. Ping or Delete - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.OperationTypeConverter))] - public partial struct Operation : - System.Management.Automation.IArgumentCompleter - { - - /// - /// Implementations of this function are called by PowerShell to complete arguments. - /// - /// The name of the command that needs argument completion. - /// The name of the parameter that needs argument completion. - /// The (possibly empty) word being completed. - /// The command ast in case it is needed for completion. - /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot - /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. - /// - /// A collection of completion results, most like with ResultType set to ParameterValue. - /// - public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) - { - if (global::System.String.IsNullOrEmpty(wordToComplete) || "DeletePrivateStoreOffer".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'DeletePrivateStoreOffer'", "DeletePrivateStoreOffer", global::System.Management.Automation.CompletionResultType.ParameterValue, "DeletePrivateStoreOffer"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "DeletePrivateStoreCollection".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'DeletePrivateStoreCollection'", "DeletePrivateStoreCollection", global::System.Management.Automation.CompletionResultType.ParameterValue, "DeletePrivateStoreCollection"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "DeletePrivateStoreCollectionOffer".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'DeletePrivateStoreCollectionOffer'", "DeletePrivateStoreCollectionOffer", global::System.Management.Automation.CompletionResultType.ParameterValue, "DeletePrivateStoreCollectionOffer"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Ping".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Ping'", "Ping", global::System.Management.Automation.CompletionResultType.ParameterValue, "Ping"); - } - } - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Operation.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Support/Operation.TypeConverter.cs deleted file mode 100644 index 23e98c3f9326..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Operation.TypeConverter.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support -{ - - /// Set the Operation for the POST method. Ping or Delete - public partial class OperationTypeConverter : - global::System.Management.Automation.PSTypeConverter - { - - /// - /// Determines if the converter can convert the parameter to the - /// parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. - /// - public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; - - /// - /// Determines if the converter can convert the parameter to the - /// parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. - /// - public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; - - /// - /// Converts the parameter to the parameter using and - /// - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// - /// an instance of , or null if there is no suitable conversion. - /// - public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => Operation.CreateFrom(sourceValue); - - /// NotImplemented -- this will return null - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// will always return null. - public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Operation.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Support/Operation.cs deleted file mode 100644 index 7ad38336483e..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Operation.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support -{ - - /// Set the Operation for the POST method. Ping or Delete - public partial struct Operation : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Operation DeletePrivateStoreCollection = @"DeletePrivateStoreCollection"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Operation DeletePrivateStoreCollectionOffer = @"DeletePrivateStoreCollectionOffer"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Operation DeletePrivateStoreOffer = @"DeletePrivateStoreOffer"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Operation Ping = @"Ping"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Conversion from arbitrary object to Operation - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new Operation(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type Operation - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Operation e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type Operation (override for Object) - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public override bool Equals(object obj) - { - return obj is Operation && Equals((Operation)obj); - } - - /// Returns hashCode for enum Operation - /// The hashCode of the value - public override int GetHashCode() - { - return this._value.GetHashCode(); - } - - /// Creates an instance of the - /// the value to create an instance for. - private Operation(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Returns string representation for Operation - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to Operation - /// the value to convert to an instance of . - - public static implicit operator Operation(string value) - { - return new Operation(value); - } - - /// Implicit operator to convert Operation to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Operation e) - { - return e._value; - } - - /// Overriding != operator for enum Operation - /// the value to compare against - /// the value to compare against - /// true if the two instances are not equal to the same value - public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Operation e1, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Operation e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum Operation - /// the value to compare against - /// the value to compare against - /// true if the two instances are equal to the same value - public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Operation e1, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Operation e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Status.Completer.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Support/Status.Completer.cs deleted file mode 100644 index fc40bb1b9e2e..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Status.Completer.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support -{ - - /// Gets the plan status - [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.StatusTypeConverter))] - public partial struct Status : - System.Management.Automation.IArgumentCompleter - { - - /// - /// Implementations of this function are called by PowerShell to complete arguments. - /// - /// The name of the command that needs argument completion. - /// The name of the parameter that needs argument completion. - /// The (possibly empty) word being completed. - /// The command ast in case it is needed for completion. - /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot - /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. - /// - /// A collection of completion results, most like with ResultType set to ParameterValue. - /// - public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) - { - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Pending".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Pending'", "Pending", global::System.Management.Automation.CompletionResultType.ParameterValue, "Pending"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Rejected".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Rejected'", "Rejected", global::System.Management.Automation.CompletionResultType.ParameterValue, "Rejected"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "Approved".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'Approved'", "Approved", global::System.Management.Automation.CompletionResultType.ParameterValue, "Approved"); - } - if (global::System.String.IsNullOrEmpty(wordToComplete) || "None".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) - { - yield return new global::System.Management.Automation.CompletionResult("'None'", "None", global::System.Management.Automation.CompletionResultType.ParameterValue, "None"); - } - } - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Status.TypeConverter.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Support/Status.TypeConverter.cs deleted file mode 100644 index 8dbd04dabe67..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Status.TypeConverter.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support -{ - - /// Gets the plan status - public partial class StatusTypeConverter : - global::System.Management.Automation.PSTypeConverter - { - - /// - /// Determines if the converter can convert the parameter to the - /// parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. - /// - public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; - - /// - /// Determines if the converter can convert the parameter to the - /// parameter. - /// - /// the to convert from - /// the to convert to - /// - /// true if the converter can convert the parameter to the - /// parameter, otherwise false. - /// - public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; - - /// - /// Converts the parameter to the parameter using and - /// - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// - /// an instance of , or null if there is no suitable conversion. - /// - public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => Status.CreateFrom(sourceValue); - - /// NotImplemented -- this will return null - /// the to convert from - /// the to convert to - /// not used by this TypeConverter. - /// when set to true, will ignore the case when converting. - /// will always return null. - public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Status.cs b/src/Marketplace/Marketplace.Autorest/generated/api/Support/Status.cs deleted file mode 100644 index c349fc30f9f2..000000000000 --- a/src/Marketplace/Marketplace.Autorest/generated/api/Support/Status.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support -{ - - /// Gets the plan status - public partial struct Status : - System.IEquatable - { - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status Approved = @"Approved"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status None = @"None"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status Pending = @"Pending"; - - public static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status Rejected = @"Rejected"; - - /// the value for an instance of the Enum. - private string _value { get; set; } - - /// Conversion from arbitrary object to Status - /// the value to convert to an instance of . - internal static object CreateFrom(object value) - { - return new Status(global::System.Convert.ToString(value)); - } - - /// Compares values of enum type Status - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status e) - { - return _value.Equals(e._value); - } - - /// Compares values of enum type Status (override for Object) - /// the value to compare against this instance. - /// true if the two instances are equal to the same value - public override bool Equals(object obj) - { - return obj is Status && Equals((Status)obj); - } - - /// Returns hashCode for enum Status - /// The hashCode of the value - public override int GetHashCode() - { - return this._value.GetHashCode(); - } - - /// Creates an instance of the - /// the value to create an instance for. - private Status(string underlyingValue) - { - this._value = underlyingValue; - } - - /// Returns string representation for Status - /// A string for this value. - public override string ToString() - { - return this._value; - } - - /// Implicit operator to convert string to Status - /// the value to convert to an instance of . - - public static implicit operator Status(string value) - { - return new Status(value); - } - - /// Implicit operator to convert Status to string - /// the value to convert to an instance of . - - public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status e) - { - return e._value; - } - - /// Overriding != operator for enum Status - /// the value to compare against - /// the value to compare against - /// true if the two instances are not equal to the same value - public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status e1, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status e2) - { - return !e2.Equals(e1); - } - - /// Overriding == operator for enum Status - /// the value to compare against - /// the value to compare against - /// true if the two instances are equal to the same value - public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status e1, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Status e2) - { - return e2.Equals(e1); - } - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_Transfer.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_Transfer.cs index 872dcaf45f12..83e362c9ca47 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_Transfer.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_Transfer.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// @@ -15,11 +17,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] TransferOffers=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Copy, @"AzMarketplacePrivateStoreCollectionOffer_Transfer", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"transferring offers (copy or move) from source collection to target collection(s)")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers", ApiVersion = "2023-01-01")] public partial class CopyAzMarketplacePrivateStoreCollectionOffer_Transfer : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -35,11 +39,26 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_Transfer : glo /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; @@ -58,14 +77,18 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_Transfer : glo public string CollectionId { get => this._collectionId; set => this._collectionId = value; } /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -82,15 +105,15 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_Transfer : glo public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties _payload; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties _payload; /// Transfer offers properties [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Transfer offers properties", ValueFromPipeline = true)] @@ -99,13 +122,14 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_Transfer : glo ReadOnly = false, Description = @"Transfer offers properties", SerializedName = @"payload", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties) })] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties Payload { get => this._payload; set => this._payload = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties Payload { get => this._payload; set => this._payload = value; } /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Backing field for property. private string _privateStoreId; @@ -142,30 +166,35 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_Transfer : glo /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -175,7 +204,7 @@ protected override void BeginProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public CopyAzMarketplacePrivateStoreCollectionOffer_Transfer() { @@ -185,7 +214,11 @@ public CopyAzMarketplacePrivateStoreCollectionOffer_Transfer() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// Handles/Dispatches events during the call to the REST service. @@ -232,8 +265,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -288,9 +346,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -308,7 +365,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId,body=Payload}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -331,12 +388,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -353,15 +410,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, CollectionId=CollectionId, body=Payload }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, CollectionId=CollectionId, body=Payload }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -371,12 +428,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -388,8 +445,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferExpanded.cs index f9e7b03fbaf3..dd3a329f0b02 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferExpanded.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferExpanded.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// @@ -15,11 +17,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] TransferOffers=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Copy, @"AzMarketplacePrivateStoreCollectionOffer_TransferExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"transferring offers (copy or move) from source collection to target collection(s)")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers", ApiVersion = "2023-01-01")] public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -35,11 +39,29 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferExpand /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// Transfer offers properties + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.TransferOffersProperties(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; @@ -58,14 +80,18 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferExpand public string CollectionId { get => this._collectionId; set => this._collectionId = value; } /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -82,11 +108,11 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferExpand public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// Offers ids list to transfer from source collection to target collection(s) @@ -99,7 +125,7 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferExpand Description = @"Offers ids list to transfer from source collection to target collection(s)", SerializedName = @"offerIdsList", PossibleTypes = new [] { typeof(string) })] - public string[] OfferIdList { get => PayloadBody.OfferIdsList ?? null /* arrayOf */; set => PayloadBody.OfferIdsList = value; } + public string[] OfferIdList { get => _payloadBody.OfferIdsList?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.OfferIdsList = (value != null ? new System.Collections.Generic.List(value) : null); } /// Operation to perform (For example: Copy or Move) [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Operation to perform (For example: Copy or Move)")] @@ -110,18 +136,12 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferExpand Description = @"Operation to perform (For example: Copy or Move)", SerializedName = @"operation", PossibleTypes = new [] { typeof(string) })] - public string Operation { get => PayloadBody.Operation ?? null; set => PayloadBody.Operation = value; } - - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties _payloadBody= new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.TransferOffersProperties(); - - /// Transfer offers properties - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties PayloadBody { get => this._payloadBody; set => this._payloadBody = value; } + public string Operation { get => _payloadBody.Operation ?? null; set => _payloadBody.Operation = value; } /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Backing field for property. private string _privateStoreId; @@ -163,37 +183,42 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferExpand Description = @"Target collections ids", SerializedName = @"targetCollections", PossibleTypes = new [] { typeof(string) })] - public string[] TargetCollection { get => PayloadBody.TargetCollection ?? null /* arrayOf */; set => PayloadBody.TargetCollection = value; } + public string[] TargetCollection { get => _payloadBody.TargetCollection?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.TargetCollection = (value != null ? new System.Collections.Generic.List(value) : null); } /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -203,7 +228,8 @@ protected override void BeginProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet + /// class. /// public CopyAzMarketplacePrivateStoreCollectionOffer_TransferExpanded() { @@ -213,7 +239,11 @@ public CopyAzMarketplacePrivateStoreCollectionOffer_TransferExpanded() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// Handles/Dispatches events during the call to the REST service. @@ -260,8 +290,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -316,9 +371,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -331,12 +385,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.PrivateStoreCollectionTransferOffers(PrivateStoreId, CollectionId, PayloadBody, onOk, onDefault, this, Pipeline); + await this.Client.PrivateStoreCollectionTransferOffers(PrivateStoreId, CollectionId, _payloadBody, onOk, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId,body=PayloadBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -359,12 +413,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -381,15 +435,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, CollectionId=CollectionId, body=PayloadBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, CollectionId=CollectionId, body=PayloadBody }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -399,12 +453,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -416,8 +470,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentity.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentity.cs index c18fc11db914..a0f2d82219bb 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentity.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// @@ -15,11 +17,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] TransferOffers=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Copy, @"AzMarketplacePrivateStoreCollectionOffer_TransferViaIdentity", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"transferring offers (copy or move) from source collection to target collection(s)")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers", ApiVersion = "2023-01-01")] public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -35,23 +39,42 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIde /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -76,15 +99,15 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIde public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties _payload; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties _payload; /// Transfer offers properties [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Transfer offers properties", ValueFromPipeline = true)] @@ -93,13 +116,14 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIde ReadOnly = false, Description = @"Transfer offers properties", SerializedName = @"payload", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties) })] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties Payload { get => this._payload; set => this._payload = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties Payload { get => this._payload; set => this._payload = value; } /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -122,30 +146,35 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIde /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -155,7 +184,7 @@ protected override void BeginProcessing() } /// - /// Intializes a new instance of the cmdlet + /// Initializes a new instance of the cmdlet /// class. /// public CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentity() @@ -166,7 +195,11 @@ public CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentity() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// Handles/Dispatches events during the call to the REST service. @@ -213,8 +246,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -269,9 +327,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -305,7 +362,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Payload}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -328,12 +385,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -350,15 +407,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Payload }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Payload }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -368,12 +425,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -385,8 +442,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityExpanded.cs index 883acda9b91b..f07a6fd08d1f 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityExpanded.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityExpanded.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// @@ -15,11 +17,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] TransferOffers=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Copy, @"AzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"transferring offers (copy or move) from source collection to target collection(s)")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers", ApiVersion = "2023-01-01")] public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -35,23 +39,45 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIde /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// Transfer offers properties + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.TransferOffersProperties(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -76,11 +102,11 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIde public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// Offers ids list to transfer from source collection to target collection(s) @@ -93,7 +119,7 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIde Description = @"Offers ids list to transfer from source collection to target collection(s)", SerializedName = @"offerIdsList", PossibleTypes = new [] { typeof(string) })] - public string[] OfferIdList { get => PayloadBody.OfferIdsList ?? null /* arrayOf */; set => PayloadBody.OfferIdsList = value; } + public string[] OfferIdList { get => _payloadBody.OfferIdsList?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.OfferIdsList = (value != null ? new System.Collections.Generic.List(value) : null); } /// Operation to perform (For example: Copy or Move) [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Operation to perform (For example: Copy or Move)")] @@ -104,18 +130,12 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIde Description = @"Operation to perform (For example: Copy or Move)", SerializedName = @"operation", PossibleTypes = new [] { typeof(string) })] - public string Operation { get => PayloadBody.Operation ?? null; set => PayloadBody.Operation = value; } - - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties _payloadBody= new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.TransferOffersProperties(); - - /// Transfer offers properties - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties PayloadBody { get => this._payloadBody; set => this._payloadBody = value; } + public string Operation { get => _payloadBody.Operation ?? null; set => _payloadBody.Operation = value; } /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -143,37 +163,42 @@ public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIde Description = @"Target collections ids", SerializedName = @"targetCollections", PossibleTypes = new [] { typeof(string) })] - public string[] TargetCollection { get => PayloadBody.TargetCollection ?? null /* arrayOf */; set => PayloadBody.TargetCollection = value; } + public string[] TargetCollection { get => _payloadBody.TargetCollection?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.TargetCollection = (value != null ? new System.Collections.Generic.List(value) : null); } /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -183,7 +208,7 @@ protected override void BeginProcessing() } /// - /// Intializes a new instance of the cmdlet class. /// public CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityExpanded() @@ -194,7 +219,11 @@ public CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityExpanded( /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// Handles/Dispatches events during the call to the REST service. @@ -241,8 +270,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -297,9 +351,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -314,7 +367,7 @@ protected override void ProcessRecord() await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } if (InputObject?.Id != null) { - await this.Client.PrivateStoreCollectionTransferOffersViaIdentity(InputObject.Id, PayloadBody, onOk, onDefault, this, Pipeline); + await this.Client.PrivateStoreCollectionTransferOffersViaIdentity(InputObject.Id, _payloadBody, onOk, onDefault, this, Pipeline); } else { @@ -327,13 +380,13 @@ protected override void ProcessRecord() { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.CollectionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); } - await this.Client.PrivateStoreCollectionTransferOffers(InputObject.PrivateStoreId ?? null, InputObject.CollectionId ?? null, PayloadBody, onOk, onDefault, this, Pipeline); + await this.Client.PrivateStoreCollectionTransferOffers(InputObject.PrivateStoreId ?? null, InputObject.CollectionId ?? null, _payloadBody, onOk, onDefault, this, Pipeline); } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=PayloadBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -356,12 +409,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -378,15 +431,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=PayloadBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=PayloadBody }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -396,12 +449,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -413,8 +466,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersResponse - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityPrivateStore.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityPrivateStore.cs new file mode 100644 index 000000000000..2987b7c28a9a --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityPrivateStore.cs @@ -0,0 +1,479 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// + /// transferring offers (copy or move) from source collection to target collection(s) + /// + /// + /// [OpenAPI] TransferOffers=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Copy, @"AzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityPrivateStore", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"transferring offers (copy or move) from source collection to target collection(s)")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers", ApiVersion = "2023-01-01")] + public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityPrivateStore : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties _payload; + + /// Transfer offers properties + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Transfer offers properties", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Transfer offers properties", + SerializedName = @"payload", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties Payload { get => this._payload; set => this._payload = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _privateStoreInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity PrivateStoreInputObject { get => this._privateStoreInputObject; set => this._privateStoreInputObject = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityPrivateStore() + { + + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionTransferOffers' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (PrivateStoreInputObject?.Id != null) + { + this.PrivateStoreInputObject.Id += $"/collections/{(global::System.Uri.EscapeDataString(this.CollectionId.ToString()))}"; + await this.Client.PrivateStoreCollectionTransferOffersViaIdentity(PrivateStoreInputObject.Id, Payload, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == PrivateStoreInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("PrivateStoreInputObject has null value for PrivateStoreInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, PrivateStoreInputObject) ); + } + await this.Client.PrivateStoreCollectionTransferOffers(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, Payload, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityPrivateStoreExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityPrivateStoreExpanded.cs new file mode 100644 index 000000000000..0397436d1faa --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityPrivateStoreExpanded.cs @@ -0,0 +1,503 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// + /// transferring offers (copy or move) from source collection to target collection(s) + /// + /// + /// [OpenAPI] TransferOffers=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Copy, @"AzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityPrivateStoreExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"transferring offers (copy or move) from source collection to target collection(s)")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers", ApiVersion = "2023-01-01")] + public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityPrivateStoreExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// Transfer offers properties + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.TransferOffersProperties(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Offers ids list to transfer from source collection to target collection(s) + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Offers ids list to transfer from source collection to target collection(s)")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Offers ids list to transfer from source collection to target collection(s)", + SerializedName = @"offerIdsList", + PossibleTypes = new [] { typeof(string) })] + public string[] OfferIdList { get => _payloadBody.OfferIdsList?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.OfferIdsList = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// Operation to perform (For example: Copy or Move) + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Operation to perform (For example: Copy or Move)")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Operation to perform (For example: Copy or Move)", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + public string Operation { get => _payloadBody.Operation ?? null; set => _payloadBody.Operation = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _privateStoreInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity PrivateStoreInputObject { get => this._privateStoreInputObject; set => this._privateStoreInputObject = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Target collections ids + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Target collections ids")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Target collections ids", + SerializedName = @"targetCollections", + PossibleTypes = new [] { typeof(string) })] + public string[] TargetCollection { get => _payloadBody.TargetCollection?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.TargetCollection = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaIdentityPrivateStoreExpanded() + { + + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionTransferOffers' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (PrivateStoreInputObject?.Id != null) + { + this.PrivateStoreInputObject.Id += $"/collections/{(global::System.Uri.EscapeDataString(this.CollectionId.ToString()))}"; + await this.Client.PrivateStoreCollectionTransferOffersViaIdentity(PrivateStoreInputObject.Id, _payloadBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == PrivateStoreInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("PrivateStoreInputObject has null value for PrivateStoreInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, PrivateStoreInputObject) ); + } + await this.Client.PrivateStoreCollectionTransferOffers(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, _payloadBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaJsonFilePath.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaJsonFilePath.cs new file mode 100644 index 000000000000..8e5dec2108ea --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaJsonFilePath.cs @@ -0,0 +1,474 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// + /// transferring offers (copy or move) from source collection to target collection(s) + /// + /// + /// [OpenAPI] TransferOffers=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Copy, @"AzMarketplacePrivateStoreCollectionOffer_TransferViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"transferring offers (copy or move) from source collection to target collection(s)")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers", ApiVersion = "2023-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.NotSuggestDefaultParameterSet] + public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + public global::System.String _jsonString; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Transfer operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Transfer operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Transfer operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Initializes a new instance of the + /// cmdlet class. + /// + public CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaJsonFilePath() + { + + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionTransferOffers' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCollectionTransferOffersViaJsonString(PrivateStoreId, CollectionId, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaJsonString.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaJsonString.cs new file mode 100644 index 000000000000..0a3a410d9181 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaJsonString.cs @@ -0,0 +1,472 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// + /// transferring offers (copy or move) from source collection to target collection(s) + /// + /// + /// [OpenAPI] TransferOffers=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Copy, @"AzMarketplacePrivateStoreCollectionOffer_TransferViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"transferring offers (copy or move) from source collection to target collection(s)")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers", ApiVersion = "2023-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.NotSuggestDefaultParameterSet] + public partial class CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Transfer operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Transfer operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Transfer operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public CopyAzMarketplacePrivateStoreCollectionOffer_TransferViaJsonString() + { + + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionTransferOffers' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCollectionTransferOffersViaJsonString(PrivateStoreId, CollectionId, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/DisableAzMarketplacePrivateStoreCollectionAllItem_Disable.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/DisableAzMarketplacePrivateStoreCollectionAllItem_Disable.cs new file mode 100644 index 000000000000..e38df28cdbe2 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/DisableAzMarketplacePrivateStoreCollectionAllItem_Disable.cs @@ -0,0 +1,455 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Disable approve all items for the collection. + /// + /// [OpenAPI] DisableApproveAllItems=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/disableApproveAllItems" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Disable, @"AzMarketplacePrivateStoreCollectionAllItem_Disable", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Disable approve all items for the collection.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/disableApproveAllItems", ApiVersion = "2023-01-01")] + public partial class DisableAzMarketplacePrivateStoreCollectionAllItem_Disable : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public DisableAzMarketplacePrivateStoreCollectionAllItem_Disable() + { + + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionDisableApproveAllItems' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCollectionDisableApproveAllItems(PrivateStoreId, CollectionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/DisableAzMarketplacePrivateStoreCollectionAllItem_DisableViaIdentity.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/DisableAzMarketplacePrivateStoreCollectionAllItem_DisableViaIdentity.cs new file mode 100644 index 000000000000..f4e82d162cda --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/DisableAzMarketplacePrivateStoreCollectionAllItem_DisableViaIdentity.cs @@ -0,0 +1,452 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Disable approve all items for the collection. + /// + /// [OpenAPI] DisableApproveAllItems=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/disableApproveAllItems" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Disable, @"AzMarketplacePrivateStoreCollectionAllItem_DisableViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Disable approve all items for the collection.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/disableApproveAllItems", ApiVersion = "2023-01-01")] + public partial class DisableAzMarketplacePrivateStoreCollectionAllItem_DisableViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Initializes a new instance of the + /// cmdlet class. + /// + public DisableAzMarketplacePrivateStoreCollectionAllItem_DisableViaIdentity() + { + + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionDisableApproveAllItems' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PrivateStoreCollectionDisableApproveAllItemsViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.CollectionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.CollectionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PrivateStoreCollectionDisableApproveAllItems(InputObject.PrivateStoreId ?? null, InputObject.CollectionId ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/DisableAzMarketplacePrivateStoreCollectionAllItem_DisableViaIdentityPrivateStore.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/DisableAzMarketplacePrivateStoreCollectionAllItem_DisableViaIdentityPrivateStore.cs new file mode 100644 index 000000000000..09ee8cf46aee --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/DisableAzMarketplacePrivateStoreCollectionAllItem_DisableViaIdentityPrivateStore.cs @@ -0,0 +1,463 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Disable approve all items for the collection. + /// + /// [OpenAPI] DisableApproveAllItems=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/disableApproveAllItems" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Disable, @"AzMarketplacePrivateStoreCollectionAllItem_DisableViaIdentityPrivateStore", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Disable approve all items for the collection.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/disableApproveAllItems", ApiVersion = "2023-01-01")] + public partial class DisableAzMarketplacePrivateStoreCollectionAllItem_DisableViaIdentityPrivateStore : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _privateStoreInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity PrivateStoreInputObject { get => this._privateStoreInputObject; set => this._privateStoreInputObject = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public DisableAzMarketplacePrivateStoreCollectionAllItem_DisableViaIdentityPrivateStore() + { + + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionDisableApproveAllItems' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (PrivateStoreInputObject?.Id != null) + { + this.PrivateStoreInputObject.Id += $"/collections/{(global::System.Uri.EscapeDataString(this.CollectionId.ToString()))}"; + await this.Client.PrivateStoreCollectionDisableApproveAllItemsViaIdentity(PrivateStoreInputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == PrivateStoreInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("PrivateStoreInputObject has null value for PrivateStoreInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, PrivateStoreInputObject) ); + } + await this.Client.PrivateStoreCollectionDisableApproveAllItems(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/EnableAzMarketplacePrivateStoreCollectionAllItem_Approve.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/EnableAzMarketplacePrivateStoreCollectionAllItem_Approve.cs new file mode 100644 index 000000000000..ce2e1ae9b0f3 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/EnableAzMarketplacePrivateStoreCollectionAllItem_Approve.cs @@ -0,0 +1,455 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Delete all existing offers from the collection and enable approve all items. + /// + /// [OpenAPI] ApproveAllItems=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/approveAllItems" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Enable, @"AzMarketplacePrivateStoreCollectionAllItem_Approve", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Delete all existing offers from the collection and enable approve all items.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/approveAllItems", ApiVersion = "2023-01-01")] + public partial class EnableAzMarketplacePrivateStoreCollectionAllItem_Approve : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public EnableAzMarketplacePrivateStoreCollectionAllItem_Approve() + { + + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionApproveAllItems' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCollectionApproveAllItems(PrivateStoreId, CollectionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/EnableAzMarketplacePrivateStoreCollectionAllItem_ApproveViaIdentity.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/EnableAzMarketplacePrivateStoreCollectionAllItem_ApproveViaIdentity.cs new file mode 100644 index 000000000000..3cdcd746c96d --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/EnableAzMarketplacePrivateStoreCollectionAllItem_ApproveViaIdentity.cs @@ -0,0 +1,452 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Delete all existing offers from the collection and enable approve all items. + /// + /// [OpenAPI] ApproveAllItems=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/approveAllItems" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Enable, @"AzMarketplacePrivateStoreCollectionAllItem_ApproveViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Delete all existing offers from the collection and enable approve all items.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/approveAllItems", ApiVersion = "2023-01-01")] + public partial class EnableAzMarketplacePrivateStoreCollectionAllItem_ApproveViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public EnableAzMarketplacePrivateStoreCollectionAllItem_ApproveViaIdentity() + { + + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionApproveAllItems' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PrivateStoreCollectionApproveAllItemsViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.CollectionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.CollectionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PrivateStoreCollectionApproveAllItems(InputObject.PrivateStoreId ?? null, InputObject.CollectionId ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/EnableAzMarketplacePrivateStoreCollectionAllItem_ApproveViaIdentityPrivateStore.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/EnableAzMarketplacePrivateStoreCollectionAllItem_ApproveViaIdentityPrivateStore.cs new file mode 100644 index 000000000000..738c67cc19e4 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/EnableAzMarketplacePrivateStoreCollectionAllItem_ApproveViaIdentityPrivateStore.cs @@ -0,0 +1,463 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Delete all existing offers from the collection and enable approve all items. + /// + /// [OpenAPI] ApproveAllItems=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/approveAllItems" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Enable, @"AzMarketplacePrivateStoreCollectionAllItem_ApproveViaIdentityPrivateStore", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Delete all existing offers from the collection and enable approve all items.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/approveAllItems", ApiVersion = "2023-01-01")] + public partial class EnableAzMarketplacePrivateStoreCollectionAllItem_ApproveViaIdentityPrivateStore : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _privateStoreInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity PrivateStoreInputObject { get => this._privateStoreInputObject; set => this._privateStoreInputObject = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public EnableAzMarketplacePrivateStoreCollectionAllItem_ApproveViaIdentityPrivateStore() + { + + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionApproveAllItems' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (PrivateStoreInputObject?.Id != null) + { + this.PrivateStoreInputObject.Id += $"/collections/{(global::System.Uri.EscapeDataString(this.CollectionId.ToString()))}"; + await this.Client.PrivateStoreCollectionApproveAllItemsViaIdentity(PrivateStoreInputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == PrivateStoreInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("PrivateStoreInputObject has null value for PrivateStoreInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, PrivateStoreInputObject) ); + } + await this.Client.PrivateStoreCollectionApproveAllItems(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceBillingPrivateStoreAccount_Billing.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceBillingPrivateStoreAccount_Billing.cs index dd09d4f036fe..94f261404488 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceBillingPrivateStoreAccount_Billing.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceBillingPrivateStoreAccount_Billing.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Tenant billing accounts names @@ -13,11 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] BillingAccounts=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/billingAccounts" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplaceBillingPrivateStoreAccount_Billing", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(string))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Tenant billing accounts names")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/billingAccounts", ApiVersion = "2023-01-01")] public partial class GetAzMarketplaceBillingPrivateStoreAccount_Billing : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,23 +37,42 @@ public partial class GetAzMarketplaceBillingPrivateStoreAccount_Billing : global /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -66,17 +89,17 @@ public partial class GetAzMarketplaceBillingPrivateStoreAccount_Billing : global public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Backing field for property. private string _privateStoreId; @@ -113,30 +136,35 @@ public partial class GetAzMarketplaceBillingPrivateStoreAccount_Billing : global /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -148,11 +176,15 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzMarketplaceBillingPrivateStoreAccount_Billing() { @@ -203,8 +235,33 @@ public GetAzMarketplaceBillingPrivateStoreAccount_Billing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -259,9 +316,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -279,7 +335,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -302,12 +358,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -324,15 +380,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -342,12 +398,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -359,9 +415,33 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse + var result = (await response); // response should be returning an array of some kind. +Pageable // nested-array / billingAccounts / - WriteObject((await response).BillingAccount, true); + if (null != result.BillingAccount) + { + if (0 == _responseSize && 1 == result.BillingAccount.Count) + { + _firstResponse = result.BillingAccount[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.BillingAccount ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceBillingPrivateStoreAccount_BillingViaIdentity.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceBillingPrivateStoreAccount_BillingViaIdentity.cs index e51dff5b6d79..f5b3ba07f3db 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceBillingPrivateStoreAccount_BillingViaIdentity.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceBillingPrivateStoreAccount_BillingViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Tenant billing accounts names @@ -13,11 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] BillingAccounts=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/billingAccounts" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplaceBillingPrivateStoreAccount_BillingViaIdentity", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(string))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Tenant billing accounts names")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/billingAccounts", ApiVersion = "2023-01-01")] public partial class GetAzMarketplaceBillingPrivateStoreAccount_BillingViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,23 +37,42 @@ public partial class GetAzMarketplaceBillingPrivateStoreAccount_BillingViaIdenti /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -74,17 +97,17 @@ public partial class GetAzMarketplaceBillingPrivateStoreAccount_BillingViaIdenti public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -107,30 +130,35 @@ public partial class GetAzMarketplaceBillingPrivateStoreAccount_BillingViaIdenti /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -142,11 +170,16 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet + /// class. /// public GetAzMarketplaceBillingPrivateStoreAccount_BillingViaIdentity() { @@ -197,8 +230,33 @@ public GetAzMarketplaceBillingPrivateStoreAccount_BillingViaIdentity() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -253,9 +311,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -285,7 +342,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -308,12 +365,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -330,7 +387,7 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } @@ -348,12 +405,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -365,9 +422,33 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse + var result = (await response); // response should be returning an array of some kind. +Pageable // nested-array / billingAccounts / - WriteObject((await response).BillingAccount, true); + if (null != result.BillingAccount) + { + if (0 == _responseSize && 1 == result.BillingAccount.Count) + { + _firstResponse = result.BillingAccount[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.BillingAccount ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_Collections.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_Collections.cs index e6b0bfbbf86b..2d46aead247e 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_Collections.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_Collections.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// @@ -16,11 +18,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] CollectionsToSubscriptionsMapping=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collectionsToSubscriptionsMapping" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplaceCollectionToSubscriptionMapping_Collections", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied list.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collectionsToSubscriptionsMapping", ApiVersion = "2023-01-01")] public partial class GetAzMarketplaceCollectionToSubscriptionMapping_Collections : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -36,23 +40,42 @@ public partial class GetAzMarketplaceCollectionToSubscriptionMapping_Collections /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -69,15 +92,15 @@ public partial class GetAzMarketplaceCollectionToSubscriptionMapping_Collections public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload _payload; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload _payload; /// The subscriptions list to get the related collections [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscriptions list to get the related collections", ValueFromPipeline = true)] @@ -86,13 +109,14 @@ public partial class GetAzMarketplaceCollectionToSubscriptionMapping_Collections ReadOnly = false, Description = @"The subscriptions list to get the related collections", SerializedName = @"payload", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload) })] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload Payload { get => this._payload; set => this._payload = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload Payload { get => this._payload; set => this._payload = value; } /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Backing field for property. private string _privateStoreId; @@ -129,30 +153,35 @@ public partial class GetAzMarketplaceCollectionToSubscriptionMapping_Collections /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -164,11 +193,15 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzMarketplaceCollectionToSubscriptionMapping_Collections() { @@ -219,8 +252,33 @@ public GetAzMarketplaceCollectionToSubscriptionMapping_Collections() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -275,9 +333,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -295,7 +352,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,body=Payload}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -318,12 +375,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -340,15 +397,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, body=Payload }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, body=Payload }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -358,12 +415,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -375,8 +432,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponse - WriteObject((await response).Detail); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsExpanded.cs index 7d89ead7c047..940a243c1f31 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsExpanded.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsExpanded.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// @@ -16,11 +18,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] CollectionsToSubscriptionsMapping=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collectionsToSubscriptionsMapping" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplaceCollectionToSubscriptionMapping_CollectionsExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied list.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collectionsToSubscriptionsMapping", ApiVersion = "2023-01-01")] public partial class GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -36,23 +40,45 @@ public partial class GetAzMarketplaceCollectionToSubscriptionMapping_Collections /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// The subscriptions list to get the related collections + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsToSubscriptionsMappingPayload(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -69,23 +95,17 @@ public partial class GetAzMarketplaceCollectionToSubscriptionMapping_Collections public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload _payloadBody= new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsToSubscriptionsMappingPayload(); - - /// The subscriptions list to get the related collections - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload PayloadBody { get => this._payloadBody; set => this._payloadBody = value; } - /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Backing field for property. private string _privateStoreId; @@ -130,38 +150,44 @@ public partial class GetAzMarketplaceCollectionToSubscriptionMapping_Collections [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] - public string[] SubscriptionId { get => PayloadBody.SubscriptionId ?? null /* arrayOf */; set => PayloadBody.SubscriptionId = value; } + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + public string[] SubscriptionId { get => _payloadBody.SubscriptionId?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SubscriptionId = (value != null ? new System.Collections.Generic.List(value) : null); } /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -173,11 +199,15 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// - /// Intializes a new instance of the cmdlet + /// Initializes a new instance of the cmdlet /// class. /// public GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsExpanded() @@ -229,8 +259,33 @@ public GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsExpanded() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -285,9 +340,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -300,12 +354,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.PrivateStoreCollectionsToSubscriptionsMapping(PrivateStoreId, PayloadBody, onOk, onDefault, this, Pipeline); + await this.Client.PrivateStoreCollectionsToSubscriptionsMapping(PrivateStoreId, _payloadBody, onOk, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,body=PayloadBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -328,12 +382,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -350,15 +404,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, body=PayloadBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, body=PayloadBody }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -368,12 +422,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -385,8 +439,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponse - WriteObject((await response).Detail); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentity.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentity.cs index 5f027f917bb6..cdde1d45a771 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentity.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// @@ -16,11 +18,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] CollectionsToSubscriptionsMapping=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collectionsToSubscriptionsMapping" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentity", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied list.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collectionsToSubscriptionsMapping", ApiVersion = "2023-01-01")] public partial class GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -36,23 +40,42 @@ public partial class GetAzMarketplaceCollectionToSubscriptionMapping_Collections /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -77,15 +100,15 @@ public partial class GetAzMarketplaceCollectionToSubscriptionMapping_Collections public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload _payload; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload _payload; /// The subscriptions list to get the related collections [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscriptions list to get the related collections", ValueFromPipeline = true)] @@ -94,13 +117,14 @@ public partial class GetAzMarketplaceCollectionToSubscriptionMapping_Collections ReadOnly = false, Description = @"The subscriptions list to get the related collections", SerializedName = @"payload", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload) })] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload Payload { get => this._payload; set => this._payload = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload Payload { get => this._payload; set => this._payload = value; } /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -123,30 +147,35 @@ public partial class GetAzMarketplaceCollectionToSubscriptionMapping_Collections /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -158,11 +187,15 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// - /// Intializes a new instance of the + /// Initializes a new instance of the /// cmdlet class. /// public GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentity() @@ -214,8 +247,33 @@ public GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentity() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -270,9 +328,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -302,7 +359,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Payload}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -325,12 +382,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -347,15 +404,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Payload }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Payload }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -365,12 +422,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -382,8 +439,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponse - WriteObject((await response).Detail); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentityExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentityExpanded.cs index 8af1ae275fae..87db431cf8e6 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentityExpanded.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentityExpanded.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// @@ -16,11 +18,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] CollectionsToSubscriptionsMapping=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collectionsToSubscriptionsMapping" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentityExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponseProperties))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied list.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collectionsToSubscriptionsMapping", ApiVersion = "2023-01-01")] public partial class GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -36,23 +40,45 @@ public partial class GetAzMarketplaceCollectionToSubscriptionMapping_Collections /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// The subscriptions list to get the related collections + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionsToSubscriptionsMappingPayload(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -77,23 +103,17 @@ public partial class GetAzMarketplaceCollectionToSubscriptionMapping_Collections public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload _payloadBody= new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.CollectionsToSubscriptionsMappingPayload(); - - /// The subscriptions list to get the related collections - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload PayloadBody { get => this._payloadBody; set => this._payloadBody = value; } - /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -124,38 +144,44 @@ public partial class GetAzMarketplaceCollectionToSubscriptionMapping_Collections [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.DefaultInfo( Name = @"", Description =@"", - Script = @"(Get-AzContext).Subscription.Id")] - public string[] SubscriptionId { get => PayloadBody.SubscriptionId ?? null /* arrayOf */; set => PayloadBody.SubscriptionId = value; } + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + public string[] SubscriptionId { get => _payloadBody.SubscriptionId?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SubscriptionId = (value != null ? new System.Collections.Generic.List(value) : null); } /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -167,11 +193,15 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// - /// Intializes a new instance of the cmdlet class. /// public GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentityExpanded() @@ -223,8 +253,33 @@ public GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaIdentityExp WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -279,9 +334,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -296,7 +350,7 @@ protected override void ProcessRecord() await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } if (InputObject?.Id != null) { - await this.Client.PrivateStoreCollectionsToSubscriptionsMappingViaIdentity(InputObject.Id, PayloadBody, onOk, onDefault, this, Pipeline); + await this.Client.PrivateStoreCollectionsToSubscriptionsMappingViaIdentity(InputObject.Id, _payloadBody, onOk, onDefault, this, Pipeline); } else { @@ -305,13 +359,13 @@ protected override void ProcessRecord() { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); } - await this.Client.PrivateStoreCollectionsToSubscriptionsMapping(InputObject.PrivateStoreId ?? null, PayloadBody, onOk, onDefault, this, Pipeline); + await this.Client.PrivateStoreCollectionsToSubscriptionsMapping(InputObject.PrivateStoreId ?? null, _payloadBody, onOk, onDefault, this, Pipeline); } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=PayloadBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -334,12 +388,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -356,15 +410,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=PayloadBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=PayloadBody }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -374,12 +428,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -391,8 +445,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingResponse - WriteObject((await response).Detail); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaJsonFilePath.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaJsonFilePath.cs new file mode 100644 index 000000000000..a2a997795b5c --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaJsonFilePath.cs @@ -0,0 +1,461 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// + /// For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied + /// list. + /// + /// + /// [OpenAPI] CollectionsToSubscriptionsMapping=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collectionsToSubscriptionsMapping" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplaceCollectionToSubscriptionMapping_CollectionsViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied list.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collectionsToSubscriptionsMapping", ApiVersion = "2023-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.NotSuggestDefaultParameterSet] + public partial class GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + public global::System.String _jsonString; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Collections operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Collections operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Collections operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaJsonFilePath() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionsToSubscriptionsMapping' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCollectionsToSubscriptionsMappingViaJsonString(PrivateStoreId, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaJsonString.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaJsonString.cs new file mode 100644 index 000000000000..d433b816b856 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaJsonString.cs @@ -0,0 +1,459 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// + /// For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied + /// list. + /// + /// + /// [OpenAPI] CollectionsToSubscriptionsMapping=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collectionsToSubscriptionsMapping" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplaceCollectionToSubscriptionMapping_CollectionsViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied list.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collectionsToSubscriptionsMapping", ApiVersion = "2023-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.NotSuggestDefaultParameterSet] + public partial class GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Collections operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Collections operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Collections operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzMarketplaceCollectionToSubscriptionMapping_CollectionsViaJsonString() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionsToSubscriptionsMapping' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCollectionsToSubscriptionsMappingViaJsonString(PrivateStoreId, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceOperation_List.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceOperation_List.cs index 6e64facf1b76..fef765a336f4 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceOperation_List.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceOperation_List.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Lists all of the available Microsoft.Marketplace REST API operations. @@ -14,11 +16,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplaceOperation_List")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResult))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResult))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Lists all of the available Microsoft.Marketplace REST API operations.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/operations", ApiVersion = "2023-01-01")] public partial class GetAzMarketplaceOperation_List : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,29 +38,48 @@ public partial class GetAzMarketplaceOperation_List : global::System.Management. /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// A flag to tell whether it is the first onOK call. private bool _isFirst = true; /// Link to retrieve next page. private string _nextLink; + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -73,17 +96,17 @@ public partial class GetAzMarketplaceOperation_List : global::System.Management. public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -106,30 +129,35 @@ public partial class GetAzMarketplaceOperation_List : global::System.Management. /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResult + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -141,11 +169,15 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzMarketplaceOperation_List() { @@ -196,8 +228,33 @@ public GetAzMarketplaceOperation_List() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -249,9 +306,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -269,7 +325,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -292,12 +348,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -314,7 +370,7 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } @@ -332,12 +388,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResult + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -349,15 +405,38 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResult + var result = (await response); // response should be returning an array of some kind. +Pageable // nested-array / value / nextLink - var result = await response; - WriteObject(result.Value,true); + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } _nextLink = result.NextLink; if (_isFirst) { _isFirst = false; - while (_nextLink != null) + while (!String.IsNullOrEmpty(_nextLink)) { if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) { diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreAllSubscriptionInTenant_Fetch.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreAllSubscriptionInTenant_Fetch.cs new file mode 100644 index 000000000000..8b1245275c17 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreAllSubscriptionInTenant_Fetch.cs @@ -0,0 +1,455 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Fetch all subscriptions in tenant, only for marketplace admin + /// + /// [OpenAPI] FetchAllSubscriptionsInTenant=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/fetchAllSubscriptionsInTenant" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreAllSubscriptionInTenant_Fetch", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Fetch all subscriptions in tenant, only for marketplace admin")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/fetchAllSubscriptionsInTenant", ApiVersion = "2023-01-01")] + public partial class GetAzMarketplacePrivateStoreAllSubscriptionInTenant_Fetch : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _nextPageToken; + + /// The skip token to get the next page. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The skip token to get the next page.")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The skip token to get the next page.", + SerializedName = @"next-page-token", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Header)] + public string NextPageToken { get => this._nextPageToken; set => this._nextPageToken = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzMarketplacePrivateStoreAllSubscriptionInTenant_Fetch() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreFetchAllSubscriptionsInTenant' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreFetchAllSubscriptionsInTenant(PrivateStoreId, this.InvocationInformation.BoundParameters.ContainsKey("NextPageToken") ? NextPageToken : null, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,NextPageToken=this.InvocationInformation.BoundParameters.ContainsKey("NextPageToken") ? NextPageToken : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreAllSubscriptionInTenant_FetchViaIdentity.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreAllSubscriptionInTenant_FetchViaIdentity.cs new file mode 100644 index 000000000000..1f5c42349c98 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreAllSubscriptionInTenant_FetchViaIdentity.cs @@ -0,0 +1,462 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Fetch all subscriptions in tenant, only for marketplace admin + /// + /// [OpenAPI] FetchAllSubscriptionsInTenant=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/fetchAllSubscriptionsInTenant" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreAllSubscriptionInTenant_FetchViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Fetch all subscriptions in tenant, only for marketplace admin")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/fetchAllSubscriptionsInTenant", ApiVersion = "2023-01-01")] + public partial class GetAzMarketplacePrivateStoreAllSubscriptionInTenant_FetchViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _nextPageToken; + + /// The skip token to get the next page. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The skip token to get the next page.")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The skip token to get the next page.", + SerializedName = @"next-page-token", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Header)] + public string NextPageToken { get => this._nextPageToken; set => this._nextPageToken = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the + /// cmdlet class. + /// + public GetAzMarketplacePrivateStoreAllSubscriptionInTenant_FetchViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreFetchAllSubscriptionsInTenant' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PrivateStoreFetchAllSubscriptionsInTenantViaIdentity(InputObject.Id, this.InvocationInformation.BoundParameters.ContainsKey("NextPageToken") ? NextPageToken : null, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PrivateStoreFetchAllSubscriptionsInTenant(InputObject.PrivateStoreId ?? null, this.InvocationInformation.BoundParameters.ContainsKey("NextPageToken") ? NextPageToken : null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { NextPageToken=this.InvocationInformation.BoundParameters.ContainsKey("NextPageToken") ? NextPageToken : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionMapOffersToContext_ListExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionMapOffersToContext_ListExpanded.cs new file mode 100644 index 000000000000..27e7174b1691 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionMapOffersToContext_ListExpanded.cs @@ -0,0 +1,505 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// + /// Get a list of all offers in the given collection according to the required contexts. + /// + /// + /// [OpenAPI] ListByContexts=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/mapOffersToContexts" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreCollectionMapOffersToContext_ListExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContext))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Get a list of all offers in the given collection according to the required contexts.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/mapOffersToContexts", ApiVersion = "2023-01-01")] + public partial class GetAzMarketplacePrivateStoreCollectionMapOffersToContext_ListExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Suggested subscription list + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByAllContextsPayload _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.CollectionOffersByAllContextsPayload(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Subscription ids list + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Subscription ids list")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Subscription ids list", + SerializedName = @"subscriptionIds", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + public string[] SubscriptionId { get => _payloadBody.SubscriptionId?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SubscriptionId = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextList + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the + /// cmdlet class. + /// + public GetAzMarketplacePrivateStoreCollectionMapOffersToContext_ListExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferListByContexts' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCollectionOfferListByContexts(PrivateStoreId, CollectionId, _payloadBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextList + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContextList + var result = (await response); + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCollectionOfferListByContexts_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionOffer_Get.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionOffer_Get.cs index e9514dfb4e83..4dc6aacef191 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionOffer_Get.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionOffer_Get.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Gets information about a specific offer. @@ -13,11 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] Get=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreCollectionOffer_Get")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Gets information about a specific offer.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}", ApiVersion = "2023-01-01")] public partial class GetAzMarketplacePrivateStoreCollectionOffer_Get : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,11 +37,26 @@ public partial class GetAzMarketplacePrivateStoreCollectionOffer_Get : global::S /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; @@ -56,14 +75,18 @@ public partial class GetAzMarketplacePrivateStoreCollectionOffer_Get : global::S public string CollectionId { get => this._collectionId; set => this._collectionId = value; } /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -80,11 +103,11 @@ public partial class GetAzMarketplacePrivateStoreCollectionOffer_Get : global::S public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// Backing field for property. @@ -104,7 +127,7 @@ public partial class GetAzMarketplacePrivateStoreCollectionOffer_Get : global::S /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Backing field for property. private string _privateStoreId; @@ -141,30 +164,35 @@ public partial class GetAzMarketplacePrivateStoreCollectionOffer_Get : global::S /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -176,11 +204,15 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzMarketplacePrivateStoreCollectionOffer_Get() { @@ -231,8 +263,33 @@ public GetAzMarketplacePrivateStoreCollectionOffer_Get() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -284,9 +341,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -299,12 +355,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.PrivateStoreCollectionOfferGet(PrivateStoreId, OfferId, CollectionId, onOk, onDefault, this, Pipeline); + await this.Client.PrivateStoreCollectionOfferGet(PrivateStoreId, CollectionId, OfferId, onOk, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,OfferId=OfferId,CollectionId=CollectionId}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId,OfferId=OfferId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -327,12 +383,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -349,15 +405,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, OfferId=OfferId, CollectionId=CollectionId }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, OfferId=OfferId, CollectionId=CollectionId }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -367,12 +423,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -384,8 +440,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentity.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentity.cs index 4e3c97c74877..7b4055ed955a 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentity.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Gets information about a specific offer. @@ -13,11 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] Get=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreCollectionOffer_GetViaIdentity")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Gets information about a specific offer.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}", ApiVersion = "2023-01-01")] public partial class GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,23 +37,42 @@ public partial class GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentity /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -74,17 +97,17 @@ public partial class GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentity public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -107,30 +130,35 @@ public partial class GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentity /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -142,11 +170,15 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentity() { @@ -197,8 +229,33 @@ public GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentity() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -250,9 +307,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -276,21 +332,21 @@ protected override void ProcessRecord() { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); } - if (null == InputObject.OfferId) - { - ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.OfferId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); - } if (null == InputObject.CollectionId) { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.CollectionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); } - await this.Client.PrivateStoreCollectionOfferGet(InputObject.PrivateStoreId ?? null, InputObject.OfferId ?? null, InputObject.CollectionId ?? null, onOk, onDefault, this, Pipeline); + if (null == InputObject.OfferId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.OfferId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PrivateStoreCollectionOfferGet(InputObject.PrivateStoreId ?? null, InputObject.CollectionId ?? null, InputObject.OfferId ?? null, onOk, onDefault, this, Pipeline); } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -313,12 +369,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -335,7 +391,7 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } @@ -353,12 +409,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -370,8 +426,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentityCollection.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentityCollection.cs new file mode 100644 index 000000000000..61fb18e52573 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentityCollection.cs @@ -0,0 +1,464 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Gets information about a specific offer. + /// + /// [OpenAPI] Get=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreCollectionOffer_GetViaIdentityCollection")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Gets information about a specific offer.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}", ApiVersion = "2023-01-01")] + public partial class GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentityCollection : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _collectionInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity CollectionInputObject { get => this._collectionInputObject; set => this._collectionInputObject = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the + /// cmdlet class. + /// + public GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentityCollection() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (CollectionInputObject?.Id != null) + { + this.CollectionInputObject.Id += $"/offers/{(global::System.Uri.EscapeDataString(this.OfferId.ToString()))}"; + await this.Client.PrivateStoreCollectionOfferGetViaIdentity(CollectionInputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == CollectionInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("CollectionInputObject has null value for CollectionInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, CollectionInputObject) ); + } + if (null == CollectionInputObject.CollectionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("CollectionInputObject has null value for CollectionInputObject.CollectionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, CollectionInputObject) ); + } + await this.Client.PrivateStoreCollectionOfferGet(CollectionInputObject.PrivateStoreId ?? null, CollectionInputObject.CollectionId ?? null, OfferId, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentityPrivateStore.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentityPrivateStore.cs new file mode 100644 index 000000000000..1f8dd2aa15b1 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentityPrivateStore.cs @@ -0,0 +1,474 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Gets information about a specific offer. + /// + /// [OpenAPI] Get=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreCollectionOffer_GetViaIdentityPrivateStore")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Gets information about a specific offer.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}", ApiVersion = "2023-01-01")] + public partial class GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentityPrivateStore : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _privateStoreInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity PrivateStoreInputObject { get => this._privateStoreInputObject; set => this._privateStoreInputObject = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the + /// cmdlet class. + /// + public GetAzMarketplacePrivateStoreCollectionOffer_GetViaIdentityPrivateStore() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (PrivateStoreInputObject?.Id != null) + { + this.PrivateStoreInputObject.Id += $"/collections/{(global::System.Uri.EscapeDataString(this.CollectionId.ToString()))}/offers/{(global::System.Uri.EscapeDataString(this.OfferId.ToString()))}"; + await this.Client.PrivateStoreCollectionOfferGetViaIdentity(PrivateStoreInputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == PrivateStoreInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("PrivateStoreInputObject has null value for PrivateStoreInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, PrivateStoreInputObject) ); + } + await this.Client.PrivateStoreCollectionOfferGet(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, OfferId, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { CollectionId=CollectionId,OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionOffer_List.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionOffer_List.cs index 44dab2be1a5d..a8a225b61d19 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionOffer_List.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionOffer_List.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Get a list of all private offers in the given private store and collection @@ -13,11 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] List=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreCollectionOffer_List")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Get a list of all private offers in the given private store and collection")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers", ApiVersion = "2023-01-01")] public partial class GetAzMarketplacePrivateStoreCollectionOffer_List : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,17 +37,32 @@ public partial class GetAzMarketplacePrivateStoreCollectionOffer_List : global:: /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// A flag to tell whether it is the first onOK call. private bool _isFirst = true; /// Link to retrieve next page. private string _nextLink; + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; @@ -62,14 +81,18 @@ public partial class GetAzMarketplacePrivateStoreCollectionOffer_List : global:: public string CollectionId { get => this._collectionId; set => this._collectionId = value; } /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -86,17 +109,17 @@ public partial class GetAzMarketplacePrivateStoreCollectionOffer_List : global:: public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Backing field for property. private string _privateStoreId; @@ -133,30 +156,35 @@ public partial class GetAzMarketplacePrivateStoreCollectionOffer_List : global:: /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponse + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -168,11 +196,15 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzMarketplacePrivateStoreCollectionOffer_List() { @@ -223,8 +255,33 @@ public GetAzMarketplacePrivateStoreCollectionOffer_List() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -276,9 +333,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -296,7 +352,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -319,12 +375,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -341,15 +397,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, CollectionId=CollectionId }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, CollectionId=CollectionId }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -359,12 +415,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -376,15 +432,38 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferListResponse + var result = (await response); // response should be returning an array of some kind. +Pageable // pageable / value / nextLink - var result = await response; - WriteObject(result.Value,true); + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } _nextLink = result.NextLink; if (_isFirst) { _isFirst = false; - while (_nextLink != null) + while (!String.IsNullOrEmpty(_nextLink)) { if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) { diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionRule_Query.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionRule_Query.cs new file mode 100644 index 000000000000..0bd47f7dfac7 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionRule_Query.cs @@ -0,0 +1,482 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Get a list of all private store rules in the given private store and collection + /// + /// [OpenAPI] QueryRules=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/queryRules" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreCollectionRule_Query", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Get a list of all private store rules in the given private store and collection")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/queryRules", ApiVersion = "2023-01-01")] + public partial class GetAzMarketplacePrivateStoreCollectionRule_Query : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzMarketplacePrivateStoreCollectionRule_Query() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'QueryRules' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.QueryRules(PrivateStoreId, CollectionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse + var result = (await response); + // response should be returning an array of some kind. +Pageable + // nested-array / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.QueryRules_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionRule_QueryViaIdentity.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionRule_QueryViaIdentity.cs new file mode 100644 index 000000000000..92a51862c564 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionRule_QueryViaIdentity.cs @@ -0,0 +1,478 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Get a list of all private store rules in the given private store and collection + /// + /// [OpenAPI] QueryRules=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/queryRules" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreCollectionRule_QueryViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Get a list of all private store rules in the given private store and collection")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/queryRules", ApiVersion = "2023-01-01")] + public partial class GetAzMarketplacePrivateStoreCollectionRule_QueryViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzMarketplacePrivateStoreCollectionRule_QueryViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'QueryRules' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.QueryRulesViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.CollectionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.CollectionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.QueryRules(InputObject.PrivateStoreId ?? null, InputObject.CollectionId ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse + var result = (await response); + // response should be returning an array of some kind. +Pageable + // nested-array / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.QueryRules_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionRule_QueryViaIdentityPrivateStore.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionRule_QueryViaIdentityPrivateStore.cs new file mode 100644 index 000000000000..b535f068f600 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollectionRule_QueryViaIdentityPrivateStore.cs @@ -0,0 +1,490 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Get a list of all private store rules in the given private store and collection + /// + /// [OpenAPI] QueryRules=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/queryRules" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreCollectionRule_QueryViaIdentityPrivateStore", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Get a list of all private store rules in the given private store and collection")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/queryRules", ApiVersion = "2023-01-01")] + public partial class GetAzMarketplacePrivateStoreCollectionRule_QueryViaIdentityPrivateStore : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _privateStoreInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity PrivateStoreInputObject { get => this._privateStoreInputObject; set => this._privateStoreInputObject = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzMarketplacePrivateStoreCollectionRule_QueryViaIdentityPrivateStore() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'QueryRules' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (PrivateStoreInputObject?.Id != null) + { + this.PrivateStoreInputObject.Id += $"/collections/{(global::System.Uri.EscapeDataString(this.CollectionId.ToString()))}"; + await this.Client.QueryRulesViaIdentity(PrivateStoreInputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == PrivateStoreInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("PrivateStoreInputObject has null value for PrivateStoreInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, PrivateStoreInputObject) ); + } + await this.Client.QueryRules(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse + var result = (await response); + // response should be returning an array of some kind. +Pageable + // nested-array / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.QueryRules_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollection_Get.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollection_Get.cs index 52395116163f..3a01c6e578c9 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollection_Get.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollection_Get.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Gets private store collection @@ -13,11 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] Get=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreCollection_Get")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Gets private store collection")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}", ApiVersion = "2023-01-01")] public partial class GetAzMarketplacePrivateStoreCollection_Get : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,11 +37,26 @@ public partial class GetAzMarketplacePrivateStoreCollection_Get : global::System /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; @@ -56,14 +75,18 @@ public partial class GetAzMarketplacePrivateStoreCollection_Get : global::System public string CollectionId { get => this._collectionId; set => this._collectionId = value; } /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -80,17 +103,17 @@ public partial class GetAzMarketplacePrivateStoreCollection_Get : global::System public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Backing field for property. private string _privateStoreId; @@ -127,30 +150,35 @@ public partial class GetAzMarketplacePrivateStoreCollection_Get : global::System /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -162,11 +190,15 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzMarketplacePrivateStoreCollection_Get() { @@ -217,8 +249,33 @@ public GetAzMarketplacePrivateStoreCollection_Get() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -270,9 +327,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -290,7 +346,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -313,12 +369,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -335,15 +391,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, CollectionId=CollectionId }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, CollectionId=CollectionId }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -353,12 +409,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -370,8 +426,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollection_GetViaIdentity.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollection_GetViaIdentity.cs index 6ca934d475f3..dbe6d05eb9f4 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollection_GetViaIdentity.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollection_GetViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Gets private store collection @@ -13,11 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] Get=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreCollection_GetViaIdentity")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Gets private store collection")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}", ApiVersion = "2023-01-01")] public partial class GetAzMarketplacePrivateStoreCollection_GetViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,23 +37,42 @@ public partial class GetAzMarketplacePrivateStoreCollection_GetViaIdentity : glo /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -74,17 +97,17 @@ public partial class GetAzMarketplacePrivateStoreCollection_GetViaIdentity : glo public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -107,30 +130,35 @@ public partial class GetAzMarketplacePrivateStoreCollection_GetViaIdentity : glo /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -142,11 +170,15 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzMarketplacePrivateStoreCollection_GetViaIdentity() { @@ -197,8 +229,33 @@ public GetAzMarketplacePrivateStoreCollection_GetViaIdentity() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -250,9 +307,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -286,7 +342,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -309,12 +365,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -331,7 +387,7 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } @@ -349,12 +405,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -366,8 +422,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollection_GetViaIdentityPrivateStore.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollection_GetViaIdentityPrivateStore.cs new file mode 100644 index 000000000000..5a768898cb28 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollection_GetViaIdentityPrivateStore.cs @@ -0,0 +1,460 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Gets private store collection + /// + /// [OpenAPI] Get=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreCollection_GetViaIdentityPrivateStore")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Gets private store collection")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}", ApiVersion = "2023-01-01")] + public partial class GetAzMarketplacePrivateStoreCollection_GetViaIdentityPrivateStore : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _privateStoreInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity PrivateStoreInputObject { get => this._privateStoreInputObject; set => this._privateStoreInputObject = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public GetAzMarketplacePrivateStoreCollection_GetViaIdentityPrivateStore() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (PrivateStoreInputObject?.Id != null) + { + this.PrivateStoreInputObject.Id += $"/collections/{(global::System.Uri.EscapeDataString(this.CollectionId.ToString()))}"; + await this.Client.PrivateStoreCollectionGetViaIdentity(PrivateStoreInputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == PrivateStoreInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("PrivateStoreInputObject has null value for PrivateStoreInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, PrivateStoreInputObject) ); + } + await this.Client.PrivateStoreCollectionGet(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollection_List.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollection_List.cs index 7be5b054f3c6..d02978db688a 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollection_List.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreCollection_List.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Gets private store collections list @@ -13,11 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] List=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreCollection_List")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsList))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsList))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Gets private store collections list")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections", ApiVersion = "2023-01-01")] public partial class GetAzMarketplacePrivateStoreCollection_List : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,29 +37,48 @@ public partial class GetAzMarketplacePrivateStoreCollection_List : global::Syste /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// A flag to tell whether it is the first onOK call. private bool _isFirst = true; /// Link to retrieve next page. private string _nextLink; + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -72,17 +95,17 @@ public partial class GetAzMarketplacePrivateStoreCollection_List : global::Syste public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Backing field for property. private string _privateStoreId; @@ -119,30 +142,35 @@ public partial class GetAzMarketplacePrivateStoreCollection_List : global::Syste /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsList + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -154,11 +182,15 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzMarketplacePrivateStoreCollection_List() { @@ -209,8 +241,33 @@ public GetAzMarketplacePrivateStoreCollection_List() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -262,9 +319,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -282,7 +338,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -305,12 +361,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -327,15 +383,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -345,12 +401,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsList + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -362,15 +418,38 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsList + var result = (await response); // response should be returning an array of some kind. +Pageable // nested-array / value / nextLink - var result = await response; - WriteObject(result.Value,true); + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } _nextLink = result.NextLink; if (_isFirst) { _isFirst = false; - while (_nextLink != null) + while (!String.IsNullOrEmpty(_nextLink)) { if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) { diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreNewPlanNotification_List.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreNewPlanNotification_List.cs new file mode 100644 index 000000000000..5097acd1b794 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreNewPlanNotification_List.cs @@ -0,0 +1,448 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// List new plans notifications + /// + /// [OpenAPI] ListNewPlansNotifications=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/listNewPlansNotifications" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreNewPlanNotification_List", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsList))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"List new plans notifications")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/listNewPlansNotifications", ApiVersion = "2023-01-01")] + public partial class GetAzMarketplacePrivateStoreNewPlanNotification_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsList + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzMarketplacePrivateStoreNewPlanNotification_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreListNewPlansNotifications' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreListNewPlansNotifications(PrivateStoreId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsList + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsList + var result = (await response); + // response should be returning an array of some kind. +Pageable + // nested-array / newPlansNotifications / + if (null != result.NewPlansNotification) + { + if (0 == _responseSize && 1 == result.NewPlansNotification.Count) + { + _firstResponse = result.NewPlansNotification[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.NewPlansNotification ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreSubscription_List.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreSubscription_List.cs new file mode 100644 index 000000000000..d3fc469201d8 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreSubscription_List.cs @@ -0,0 +1,448 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// List all the subscriptions in the private store context + /// + /// [OpenAPI] ListSubscriptionsContext=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/listSubscriptionsContext" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreSubscription_List", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextList))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"List all the subscriptions in the private store context")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/listSubscriptionsContext", ApiVersion = "2023-01-01")] + public partial class GetAzMarketplacePrivateStoreSubscription_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextList + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzMarketplacePrivateStoreSubscription_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreListSubscriptionsContext' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreListSubscriptionsContext(PrivateStoreId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextList + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextList + var result = (await response); + // response should be returning an array of some kind. +Pageable + // nested-array / subscriptionsIds / + if (null != result.SubscriptionsId) + { + if (0 == _responseSize && 1 == result.SubscriptionsId.Count) + { + _firstResponse = result.SubscriptionsId[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.SubscriptionsId ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreUserOffer_QueryExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreUserOffer_QueryExpanded.cs new file mode 100644 index 000000000000..e82eb9ebdd41 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreUserOffer_QueryExpanded.cs @@ -0,0 +1,500 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// List of user's approved offers for the provided offers and subscriptions + /// + /// [OpenAPI] QueryUserOffers=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryUserOffers" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreUserOffer_QueryExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"List of user's approved offers for the provided offers and subscriptions")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryUserOffers", ApiVersion = "2023-01-01")] + public partial class GetAzMarketplacePrivateStoreUserOffer_QueryExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Query user's offers properties + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersProperties _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryUserOffersProperties(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// List of offer IDs + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of offer IDs")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of offer IDs", + SerializedName = @"offerIds", + PossibleTypes = new [] { typeof(string) })] + public string[] OfferId { get => _payloadBody.OfferId?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.OfferId = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// List of subscription IDs + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of subscription IDs")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of subscription IDs", + SerializedName = @"subscriptionIds", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + public string[] SubscriptionId { get => _payloadBody.SubscriptionId?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SubscriptionId = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzMarketplacePrivateStoreUserOffer_QueryExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreQueryUserOffers' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreQueryUserOffers(PrivateStoreId, _payloadBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers + var result = (await response); + // response should be returning an array of some kind. +Pageable + // nested-array / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreQueryUserOffers_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreUserOffer_QueryViaIdentityExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreUserOffer_QueryViaIdentityExpanded.cs new file mode 100644 index 000000000000..cc563e0119f4 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreUserOffer_QueryViaIdentityExpanded.cs @@ -0,0 +1,507 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// List of user's approved offers for the provided offers and subscriptions + /// + /// [OpenAPI] QueryUserOffers=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryUserOffers" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreUserOffer_QueryViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"List of user's approved offers for the provided offers and subscriptions")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryUserOffers", ApiVersion = "2023-01-01")] + public partial class GetAzMarketplacePrivateStoreUserOffer_QueryViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Query user's offers properties + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserOffersProperties _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryUserOffersProperties(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// List of offer IDs + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of offer IDs")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of offer IDs", + SerializedName = @"offerIds", + PossibleTypes = new [] { typeof(string) })] + public string[] OfferId { get => _payloadBody.OfferId?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.OfferId = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// List of subscription IDs + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of subscription IDs")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of subscription IDs", + SerializedName = @"subscriptionIds", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + public string[] SubscriptionId { get => _payloadBody.SubscriptionId?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SubscriptionId = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public GetAzMarketplacePrivateStoreUserOffer_QueryViaIdentityExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreQueryUserOffers' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PrivateStoreQueryUserOffersViaIdentity(InputObject.Id, _payloadBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PrivateStoreQueryUserOffers(InputObject.PrivateStoreId ?? null, _payloadBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers + var result = (await response); + // response should be returning an array of some kind. +Pageable + // nested-array / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreQueryUserOffers_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreUserRule_QueryExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreUserRule_QueryExpanded.cs new file mode 100644 index 000000000000..6075447ff3f6 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreUserRule_QueryExpanded.cs @@ -0,0 +1,490 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// + /// All rules approved in the private store that are relevant for user subscriptions + /// + /// + /// [OpenAPI] QueryUserRules=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryUserRules" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreUserRule_QueryExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"All rules approved in the private store that are relevant for user subscriptions")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryUserRules", ApiVersion = "2023-01-01")] + public partial class GetAzMarketplacePrivateStoreUserRule_QueryExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Query user's rules properties + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesProperties _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryUserRulesProperties(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// List of subscription IDs + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of subscription IDs")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of subscription IDs", + SerializedName = @"subscriptionIds", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + public string[] SubscriptionId { get => _payloadBody.SubscriptionId?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SubscriptionId = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public GetAzMarketplacePrivateStoreUserRule_QueryExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'QueryUserRules' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.QueryUserRules(PrivateStoreId, _payloadBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse + var result = (await response); + // response should be returning an array of some kind. +Pageable + // nested-array / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.QueryUserRules_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreUserRule_QueryViaIdentityExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreUserRule_QueryViaIdentityExpanded.cs new file mode 100644 index 000000000000..9e3187483d36 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreUserRule_QueryViaIdentityExpanded.cs @@ -0,0 +1,497 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// + /// All rules approved in the private store that are relevant for user subscriptions + /// + /// + /// [OpenAPI] QueryUserRules=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryUserRules" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreUserRule_QueryViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"All rules approved in the private store that are relevant for user subscriptions")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryUserRules", ApiVersion = "2023-01-01")] + public partial class GetAzMarketplacePrivateStoreUserRule_QueryViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// A flag to tell whether it is the first onOK call. + private bool _isFirst = true; + + /// Link to retrieve next page. + private string _nextLink; + + /// Query user's rules properties + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryUserRulesProperties _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.QueryUserRulesProperties(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// List of subscription IDs + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of subscription IDs")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of subscription IDs", + SerializedName = @"subscriptionIds", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id", + SetCondition = @"")] + public string[] SubscriptionId { get => _payloadBody.SubscriptionId?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SubscriptionId = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public GetAzMarketplacePrivateStoreUserRule_QueryViaIdentityExpanded() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'QueryUserRules' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.QueryUserRulesViaIdentity(InputObject.Id, _payloadBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.QueryUserRules(InputObject.PrivateStoreId ?? null, _payloadBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse + var result = (await response); + // response should be returning an array of some kind. +Pageable + // nested-array / value / nextLink + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } + _nextLink = result.NextLink; + if (_isFirst) + { + _isFirst = false; + while (!String.IsNullOrEmpty(_nextLink)) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( _nextLink ),Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.QueryUserRules_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreV1_Get.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreV1_Get.cs index 7933b61216ce..6bee936ee991 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreV1_Get.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreV1_Get.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Get information about the private store @@ -13,11 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] Get=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreV1_Get")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Get information about the private store")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}", ApiVersion = "2023-01-01")] public partial class GetAzMarketplacePrivateStoreV1_Get : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,23 +37,42 @@ public partial class GetAzMarketplacePrivateStoreV1_Get : global::System.Managem /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -81,17 +104,17 @@ public partial class GetAzMarketplacePrivateStoreV1_Get : global::System.Managem public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -114,30 +137,35 @@ public partial class GetAzMarketplacePrivateStoreV1_Get : global::System.Managem /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -149,11 +177,15 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzMarketplacePrivateStoreV1_Get() { @@ -204,8 +236,33 @@ public GetAzMarketplacePrivateStoreV1_Get() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -257,9 +314,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -277,7 +333,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Id=Id}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Id=Id}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -300,12 +356,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -322,15 +378,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Id=Id }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Id=Id }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -340,12 +396,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -357,8 +413,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreV1_GetViaIdentity.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreV1_GetViaIdentity.cs index 4ac5185c24c3..aa0653501b00 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreV1_GetViaIdentity.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreV1_GetViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Get information about the private store @@ -13,11 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] Get=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreV1_GetViaIdentity")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Get information about the private store")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}", ApiVersion = "2023-01-01")] public partial class GetAzMarketplacePrivateStoreV1_GetViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,23 +37,42 @@ public partial class GetAzMarketplacePrivateStoreV1_GetViaIdentity : global::Sys /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -74,17 +97,17 @@ public partial class GetAzMarketplacePrivateStoreV1_GetViaIdentity : global::Sys public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -107,30 +130,35 @@ public partial class GetAzMarketplacePrivateStoreV1_GetViaIdentity : global::Sys /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -142,11 +170,15 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzMarketplacePrivateStoreV1_GetViaIdentity() { @@ -197,8 +229,33 @@ public GetAzMarketplacePrivateStoreV1_GetViaIdentity() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -250,9 +307,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -282,7 +338,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -305,12 +361,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -327,7 +383,7 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } @@ -345,12 +401,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -362,8 +418,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreV1_List.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreV1_List.cs index 0cd980cd7ade..cfed25c02574 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreV1_List.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplacePrivateStoreV1_List.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Gets the list of available private stores. @@ -13,11 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] List=>GET:"/providers/Microsoft.Marketplace/privateStores" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplacePrivateStoreV1_List")] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Gets the list of available private stores.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores", ApiVersion = "2023-01-01")] public partial class GetAzMarketplacePrivateStoreV1_List : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,29 +37,48 @@ public partial class GetAzMarketplacePrivateStoreV1_List : global::System.Manage /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// A flag to tell whether it is the first onOK call. private bool _isFirst = true; /// Link to retrieve next page. private string _nextLink; + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -72,17 +95,17 @@ public partial class GetAzMarketplacePrivateStoreV1_List : global::System.Manage public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -119,30 +142,35 @@ public partial class GetAzMarketplacePrivateStoreV1_List : global::System.Manage /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreList + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -154,11 +182,15 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzMarketplacePrivateStoreV1_List() { @@ -209,8 +241,33 @@ public GetAzMarketplacePrivateStoreV1_List() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -262,9 +319,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -282,7 +338,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { UseCache=this.InvocationInformation.BoundParameters.ContainsKey("UseCache") ? UseCache : null}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { UseCache=this.InvocationInformation.BoundParameters.ContainsKey("UseCache") ? UseCache : null}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -305,12 +361,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -327,15 +383,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { UseCache=this.InvocationInformation.BoundParameters.ContainsKey("UseCache") ? UseCache : null }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { UseCache=this.InvocationInformation.BoundParameters.ContainsKey("UseCache") ? UseCache : null }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -345,12 +401,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreList + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -362,15 +418,38 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStoreList + var result = (await response); // response should be returning an array of some kind. +Pageable // pageable / value / nextLink - var result = await response; - WriteObject(result.Value,true); + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } _nextLink = result.NextLink; if (_isFirst) { _isFirst = false; - while (_nextLink != null) + while (!String.IsNullOrEmpty(_nextLink)) { if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) { diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceQueryPrivateStoreOffer_Query.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceQueryPrivateStoreOffer_Query.cs index 622537a7a097..a82c6732379d 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceQueryPrivateStoreOffer_Query.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceQueryPrivateStoreOffer_Query.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// List of offers, regardless the collections @@ -13,11 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] QueryOffers=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryOffers" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplaceQueryPrivateStoreOffer_Query", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffers))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"List of offers, regardless the collections")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryOffers", ApiVersion = "2023-01-01")] public partial class GetAzMarketplaceQueryPrivateStoreOffer_Query : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,29 +37,48 @@ public partial class GetAzMarketplaceQueryPrivateStoreOffer_Query : global::Syst /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// A flag to tell whether it is the first onOK call. private bool _isFirst = true; /// Link to retrieve next page. private string _nextLink; + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -72,17 +95,17 @@ public partial class GetAzMarketplaceQueryPrivateStoreOffer_Query : global::Syst public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Backing field for property. private string _privateStoreId; @@ -119,30 +142,35 @@ public partial class GetAzMarketplaceQueryPrivateStoreOffer_Query : global::Syst /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -154,11 +182,15 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzMarketplaceQueryPrivateStoreOffer_Query() { @@ -209,8 +241,33 @@ public GetAzMarketplaceQueryPrivateStoreOffer_Query() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -265,9 +322,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -285,7 +341,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -308,12 +364,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -330,15 +386,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -348,12 +404,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -365,15 +421,38 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers + var result = (await response); // response should be returning an array of some kind. +Pageable // nested-array / value / nextLink - var result = await response; - WriteObject(result.Value,true); + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } _nextLink = result.NextLink; if (_isFirst) { _isFirst = false; - while (_nextLink != null) + while (!String.IsNullOrEmpty(_nextLink)) { if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) { diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceQueryPrivateStoreOffer_QueryViaIdentity.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceQueryPrivateStoreOffer_QueryViaIdentity.cs index b9c3b12bb69c..38c4a4dfec0b 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceQueryPrivateStoreOffer_QueryViaIdentity.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/GetAzMarketplaceQueryPrivateStoreOffer_QueryViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// List of offers, regardless the collections @@ -13,11 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] QueryOffers=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryOffers" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMarketplaceQueryPrivateStoreOffer_QueryViaIdentity", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IQueryOffers))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"List of offers, regardless the collections")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryOffers", ApiVersion = "2023-01-01")] public partial class GetAzMarketplaceQueryPrivateStoreOffer_QueryViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,29 +37,48 @@ public partial class GetAzMarketplaceQueryPrivateStoreOffer_QueryViaIdentity : g /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + /// A flag to tell whether it is the first onOK call. private bool _isFirst = true; /// Link to retrieve next page. private string _nextLink; + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -80,17 +103,17 @@ public partial class GetAzMarketplaceQueryPrivateStoreOffer_QueryViaIdentity : g public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -113,30 +136,35 @@ public partial class GetAzMarketplaceQueryPrivateStoreOffer_QueryViaIdentity : g /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -148,11 +176,15 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public GetAzMarketplaceQueryPrivateStoreOffer_QueryViaIdentity() { @@ -203,8 +235,33 @@ public GetAzMarketplaceQueryPrivateStoreOffer_QueryViaIdentity() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -259,9 +316,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -291,7 +347,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -314,12 +370,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -336,7 +392,7 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } @@ -354,12 +410,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -371,15 +427,38 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers + var result = (await response); // response should be returning an array of some kind. +Pageable // nested-array / value / nextLink - var result = await response; - WriteObject(result.Value,true); + if (null != result.Value) + { + if (0 == _responseSize && 1 == result.Value.Count) + { + _firstResponse = result.Value[0]; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + var values = new System.Collections.Generic.List(); + foreach( var value in result.Value ) + { + values.Add(value.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(values, true); + _responseSize = 2; + } + } _nextLink = result.NextLink; if (_isFirst) { _isFirst = false; - while (_nextLink != null) + while (!String.IsNullOrEmpty(_nextLink)) { if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) { diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferExpanded.cs new file mode 100644 index 000000000000..63cb68f80501 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferExpanded.cs @@ -0,0 +1,507 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Upsert an offer with multiple context details. + /// + /// [OpenAPI] UpsertOfferWithMultiContext=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}/upsertOfferWithMultiContext" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStoreCollectionOfferMultiContext_OfferExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Upsert an offer with multiple context details.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}/upsertOfferWithMultiContext", ApiVersion = "2023-01-01")] + public partial class NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// Payload object for upsert offer with multiple context and plans. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayload _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.MultiContextAndPlansPayload(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The offer's eTag. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The offer's eTag.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The offer's eTag.", + SerializedName = @"eTag", + PossibleTypes = new [] { typeof(string) })] + public string ETag { get => _payloadBody.ETag ?? null; set => _payloadBody.ETag = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// . + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"plansContext", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails[] PlansContext { get => _payloadBody.PlansContext?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.PlansContext = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The offer ID which contains the plans. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The offer ID which contains the plans.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The offer ID which contains the plans.", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + public string PropertiesOfferId { get => _payloadBody.OfferId ?? null; set => _payloadBody.OfferId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the + /// cmdlet class. + /// + public NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferUpsertOfferWithMultiContext' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCollectionOfferUpsertOfferWithMultiContext(PrivateStoreId, CollectionId, OfferId, _payloadBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId,OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityCollectionExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityCollectionExpanded.cs new file mode 100644 index 000000000000..86f1c2367201 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityCollectionExpanded.cs @@ -0,0 +1,504 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Upsert an offer with multiple context details. + /// + /// [OpenAPI] UpsertOfferWithMultiContext=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}/upsertOfferWithMultiContext" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityCollectionExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Upsert an offer with multiple context details.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}/upsertOfferWithMultiContext", ApiVersion = "2023-01-01")] + public partial class NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityCollectionExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// Payload object for upsert offer with multiple context and plans. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayload _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.MultiContextAndPlansPayload(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _collectionInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity CollectionInputObject { get => this._collectionInputObject; set => this._collectionInputObject = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The offer's eTag. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The offer's eTag.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The offer's eTag.", + SerializedName = @"eTag", + PossibleTypes = new [] { typeof(string) })] + public string ETag { get => _payloadBody.ETag ?? null; set => _payloadBody.ETag = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// . + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"plansContext", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails[] PlansContext { get => _payloadBody.PlansContext?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.PlansContext = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// The offer ID which contains the plans. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The offer ID which contains the plans.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The offer ID which contains the plans.", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + public string PropertiesOfferId { get => _payloadBody.OfferId ?? null; set => _payloadBody.OfferId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityCollectionExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferUpsertOfferWithMultiContext' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (CollectionInputObject?.Id != null) + { + this.CollectionInputObject.Id += $"/offers/{(global::System.Uri.EscapeDataString(this.OfferId.ToString()))}"; + await this.Client.PrivateStoreCollectionOfferUpsertOfferWithMultiContextViaIdentity(CollectionInputObject.Id, _payloadBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == CollectionInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("CollectionInputObject has null value for CollectionInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, CollectionInputObject) ); + } + if (null == CollectionInputObject.CollectionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("CollectionInputObject has null value for CollectionInputObject.CollectionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, CollectionInputObject) ); + } + await this.Client.PrivateStoreCollectionOfferUpsertOfferWithMultiContext(CollectionInputObject.PrivateStoreId ?? null, CollectionInputObject.CollectionId ?? null, OfferId, _payloadBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityExpanded.cs new file mode 100644 index 000000000000..d2d88fcdaf74 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityExpanded.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Upsert an offer with multiple context details. + /// + /// [OpenAPI] UpsertOfferWithMultiContext=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}/upsertOfferWithMultiContext" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Upsert an offer with multiple context details.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}/upsertOfferWithMultiContext", ApiVersion = "2023-01-01")] + public partial class NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// Payload object for upsert offer with multiple context and plans. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayload _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.MultiContextAndPlansPayload(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The offer's eTag. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The offer's eTag.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The offer's eTag.", + SerializedName = @"eTag", + PossibleTypes = new [] { typeof(string) })] + public string ETag { get => _payloadBody.ETag ?? null; set => _payloadBody.ETag = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// The offer ID which contains the plans. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The offer ID which contains the plans.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The offer ID which contains the plans.", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + public string OfferId { get => _payloadBody.OfferId ?? null; set => _payloadBody.OfferId = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// . + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"plansContext", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails[] PlansContext { get => _payloadBody.PlansContext?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.PlansContext = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferUpsertOfferWithMultiContext' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PrivateStoreCollectionOfferUpsertOfferWithMultiContextViaIdentity(InputObject.Id, _payloadBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.CollectionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.CollectionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.OfferId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.OfferId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PrivateStoreCollectionOfferUpsertOfferWithMultiContext(InputObject.PrivateStoreId ?? null, InputObject.CollectionId ?? null, InputObject.OfferId ?? null, _payloadBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityPrivateStoreExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityPrivateStoreExpanded.cs new file mode 100644 index 000000000000..919f5e1c9eac --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityPrivateStoreExpanded.cs @@ -0,0 +1,514 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Upsert an offer with multiple context details. + /// + /// [OpenAPI] UpsertOfferWithMultiContext=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}/upsertOfferWithMultiContext" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityPrivateStoreExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Upsert an offer with multiple context details.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}/upsertOfferWithMultiContext", ApiVersion = "2023-01-01")] + public partial class NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityPrivateStoreExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// Payload object for upsert offer with multiple context and plans. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMultiContextAndPlansPayload _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.MultiContextAndPlansPayload(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The offer's eTag. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The offer's eTag.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The offer's eTag.", + SerializedName = @"eTag", + PossibleTypes = new [] { typeof(string) })] + public string ETag { get => _payloadBody.ETag ?? null; set => _payloadBody.ETag = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// . + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @".", + SerializedName = @"plansContext", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails[] PlansContext { get => _payloadBody.PlansContext?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.PlansContext = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _privateStoreInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity PrivateStoreInputObject { get => this._privateStoreInputObject; set => this._privateStoreInputObject = value; } + + /// The offer ID which contains the plans. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The offer ID which contains the plans.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The offer ID which contains the plans.", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + public string PropertiesOfferId { get => _payloadBody.OfferId ?? null; set => _payloadBody.OfferId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzMarketplacePrivateStoreCollectionOfferMultiContext_OfferViaIdentityPrivateStoreExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferUpsertOfferWithMultiContext' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (PrivateStoreInputObject?.Id != null) + { + this.PrivateStoreInputObject.Id += $"/collections/{(global::System.Uri.EscapeDataString(this.CollectionId.ToString()))}/offers/{(global::System.Uri.EscapeDataString(this.OfferId.ToString()))}"; + await this.Client.PrivateStoreCollectionOfferUpsertOfferWithMultiContextViaIdentity(PrivateStoreInputObject.Id, _payloadBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == PrivateStoreInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("PrivateStoreInputObject has null value for PrivateStoreInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, PrivateStoreInputObject) ); + } + await this.Client.PrivateStoreCollectionOfferUpsertOfferWithMultiContext(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, OfferId, _payloadBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { CollectionId=CollectionId,OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateExpanded.cs index 67bcc9758158..389314ae4d5b 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateExpanded.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateExpanded.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Update or add an offer to a specific collection of the private store. @@ -13,11 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStoreCollectionOffer_CreateExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Update or add an offer to a specific collection of the private store.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}", ApiVersion = "2023-01-01")] public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,11 +37,29 @@ public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateExpanded /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// The privateStore offer data structure. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Offer(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; @@ -56,9 +78,10 @@ public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateExpanded public string CollectionId { get => this._collectionId; set => this._collectionId = value; } /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] @@ -73,7 +96,10 @@ public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateExpanded Description = @"Identifier for purposes of race condition", SerializedName = @"eTag", PossibleTypes = new [] { typeof(string) })] - public string ETag { get => PayloadBody.ETag ?? null; set => PayloadBody.ETag = value; } + public string ETag { get => _payloadBody.ETag ?? null; set => _payloadBody.ETag = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] @@ -96,18 +122,18 @@ public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateExpanded ReadOnly = false, Description = @"Icon File Uris", SerializedName = @"iconFileUris", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris) })] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris IconFileUri { get => PayloadBody.IconFileUri ?? null /* object */; set => PayloadBody.IconFileUri = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris IconFileUri { get => _payloadBody.IconFileUri ?? null /* object */; set => _payloadBody.IconFileUri = value; } /// Accessor for our copy of the InvocationInfo. public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// Backing field for property. @@ -124,16 +150,10 @@ public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateExpanded [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] public string OfferId { get => this._offerId; set => this._offerId = value; } - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer _payloadBody= new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Offer(); - - /// The privateStore offer data structure. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer PayloadBody { get => this._payloadBody; set => this._payloadBody = value; } - /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Offer plans [global::System.Management.Automation.AllowEmptyCollection] @@ -144,8 +164,8 @@ public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateExpanded ReadOnly = false, Description = @"Offer plans", SerializedName = @"plans", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan) })] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan[] Plan { get => PayloadBody.Plan ?? null /* arrayOf */; set => PayloadBody.Plan = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[] Plan { get => _payloadBody.Plan?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.Plan = (value != null ? new System.Collections.Generic.List(value) : null); } /// Backing field for property. private string _privateStoreId; @@ -187,7 +207,7 @@ public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateExpanded Description = @"Plan ids limitation for this offer", SerializedName = @"specificPlanIdsLimitation", PossibleTypes = new [] { typeof(string) })] - public string[] SpecificPlanIdLimitation { get => PayloadBody.SpecificPlanIdsLimitation ?? null /* arrayOf */; set => PayloadBody.SpecificPlanIdsLimitation = value; } + public string[] SpecificPlanIdLimitation { get => _payloadBody.SpecificPlanIdsLimitation?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SpecificPlanIdsLimitation = (value != null ? new System.Collections.Generic.List(value) : null); } /// /// Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed @@ -201,37 +221,42 @@ public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateExpanded Description = @"Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated.", SerializedName = @"updateSuppressedDueIdempotence", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] - public global::System.Management.Automation.SwitchParameter UpdateSuppressedDueIdempotence { get => PayloadBody.UpdateSuppressedDueIdempotence ?? default(global::System.Management.Automation.SwitchParameter); set => PayloadBody.UpdateSuppressedDueIdempotence = value; } + public global::System.Management.Automation.SwitchParameter UpdateSuppressedDueIdempotence { get => _payloadBody.UpdateSuppressedDueIdempotence ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.UpdateSuppressedDueIdempotence = value; } /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -243,7 +268,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// Handles/Dispatches events during the call to the REST service. @@ -290,8 +319,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -301,7 +355,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public NewAzMarketplacePrivateStoreCollectionOffer_CreateExpanded() { @@ -354,9 +408,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -369,12 +422,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.PrivateStoreCollectionOfferCreateOrUpdate(PrivateStoreId, OfferId, CollectionId, PayloadBody, onOk, onDefault, this, Pipeline); + await this.Client.PrivateStoreCollectionOfferCreateOrUpdate(PrivateStoreId, CollectionId, OfferId, _payloadBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,OfferId=OfferId,CollectionId=CollectionId,body=PayloadBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId,OfferId=OfferId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -397,12 +450,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -419,15 +472,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, OfferId=OfferId, CollectionId=CollectionId, body=PayloadBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, OfferId=OfferId, CollectionId=CollectionId, body=PayloadBody }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -437,12 +490,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -454,8 +507,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentity.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentity.cs index afd9fd7ff354..cc9530bb6071 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentity.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Update or add an offer to a specific collection of the private store. @@ -14,11 +16,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStoreCollectionOffer_CreateViaIdentity", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Update or add an offer to a specific collection of the private store.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}", ApiVersion = "2023-01-01")] public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,23 +38,42 @@ public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdenti /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -75,15 +98,15 @@ public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdenti public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer _payload; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer _payload; /// The privateStore offer data structure. [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The privateStore offer data structure.", ValueFromPipeline = true)] @@ -92,13 +115,14 @@ public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdenti ReadOnly = false, Description = @"The privateStore offer data structure.", SerializedName = @"payload", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer) })] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer Payload { get => this._payload; set => this._payload = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer Payload { get => this._payload; set => this._payload = value; } /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -121,30 +145,35 @@ public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdenti /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -156,7 +185,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// Handles/Dispatches events during the call to the REST service. @@ -203,8 +236,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -214,7 +272,8 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet + /// class. /// public NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentity() { @@ -267,9 +326,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -284,7 +342,7 @@ protected override void ProcessRecord() await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } if (InputObject?.Id != null) { - await this.Client.PrivateStoreCollectionOfferCreateOrUpdateViaIdentity(InputObject.Id, Payload, onOk, onDefault, this, Pipeline); + await this.Client.PrivateStoreCollectionOfferCreateOrUpdateViaIdentity(InputObject.Id, Payload, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); } else { @@ -293,21 +351,21 @@ protected override void ProcessRecord() { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); } - if (null == InputObject.OfferId) - { - ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.OfferId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); - } if (null == InputObject.CollectionId) { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.CollectionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); } - await this.Client.PrivateStoreCollectionOfferCreateOrUpdate(InputObject.PrivateStoreId ?? null, InputObject.OfferId ?? null, InputObject.CollectionId ?? null, Payload, onOk, onDefault, this, Pipeline); + if (null == InputObject.OfferId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.OfferId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PrivateStoreCollectionOfferCreateOrUpdate(InputObject.PrivateStoreId ?? null, InputObject.CollectionId ?? null, InputObject.OfferId ?? null, Payload, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Payload}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -330,12 +388,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -352,15 +410,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Payload }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Payload }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -370,12 +428,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -387,8 +445,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityCollection.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityCollection.cs new file mode 100644 index 000000000000..94a82d151dad --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityCollection.cs @@ -0,0 +1,481 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Update or add an offer to a specific collection of the private store. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityCollection", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Update or add an offer to a specific collection of the private store.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}", ApiVersion = "2023-01-01")] + public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityCollection : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _collectionInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity CollectionInputObject { get => this._collectionInputObject; set => this._collectionInputObject = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer _payload; + + /// The privateStore offer data structure. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The privateStore offer data structure.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The privateStore offer data structure.", + SerializedName = @"payload", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer Payload { get => this._payload; set => this._payload = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityCollection() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (CollectionInputObject?.Id != null) + { + this.CollectionInputObject.Id += $"/offers/{(global::System.Uri.EscapeDataString(this.OfferId.ToString()))}"; + await this.Client.PrivateStoreCollectionOfferCreateOrUpdateViaIdentity(CollectionInputObject.Id, Payload, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == CollectionInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("CollectionInputObject has null value for CollectionInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, CollectionInputObject) ); + } + if (null == CollectionInputObject.CollectionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("CollectionInputObject has null value for CollectionInputObject.CollectionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, CollectionInputObject) ); + } + await this.Client.PrivateStoreCollectionOfferCreateOrUpdate(CollectionInputObject.PrivateStoreId ?? null, CollectionInputObject.CollectionId ?? null, OfferId, Payload, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityCollectionExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityCollectionExpanded.cs new file mode 100644 index 000000000000..7ddec5d9fc24 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityCollectionExpanded.cs @@ -0,0 +1,531 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Update or add an offer to a specific collection of the private store. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityCollectionExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Update or add an offer to a specific collection of the private store.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}", ApiVersion = "2023-01-01")] + public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityCollectionExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// The privateStore offer data structure. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Offer(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _collectionInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity CollectionInputObject { get => this._collectionInputObject; set => this._collectionInputObject = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Identifier for purposes of race condition + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Identifier for purposes of race condition")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Identifier for purposes of race condition", + SerializedName = @"eTag", + PossibleTypes = new [] { typeof(string) })] + public string ETag { get => _payloadBody.ETag ?? null; set => _payloadBody.ETag = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Icon File Uris + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Icon File Uris")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Icon File Uris", + SerializedName = @"iconFileUris", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris IconFileUri { get => _payloadBody.IconFileUri ?? null /* object */; set => _payloadBody.IconFileUri = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Offer plans + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Offer plans")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Offer plans", + SerializedName = @"plans", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[] Plan { get => _payloadBody.Plan?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.Plan = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Plan ids limitation for this offer + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Plan ids limitation for this offer")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Plan ids limitation for this offer", + SerializedName = @"specificPlanIdsLimitation", + PossibleTypes = new [] { typeof(string) })] + public string[] SpecificPlanIdLimitation { get => _payloadBody.SpecificPlanIdsLimitation?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SpecificPlanIdsLimitation = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed + /// one in db, the offer would not be updated. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated.", + SerializedName = @"updateSuppressedDueIdempotence", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter UpdateSuppressedDueIdempotence { get => _payloadBody.UpdateSuppressedDueIdempotence ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.UpdateSuppressedDueIdempotence = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityCollectionExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (CollectionInputObject?.Id != null) + { + this.CollectionInputObject.Id += $"/offers/{(global::System.Uri.EscapeDataString(this.OfferId.ToString()))}"; + await this.Client.PrivateStoreCollectionOfferCreateOrUpdateViaIdentity(CollectionInputObject.Id, _payloadBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == CollectionInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("CollectionInputObject has null value for CollectionInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, CollectionInputObject) ); + } + if (null == CollectionInputObject.CollectionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("CollectionInputObject has null value for CollectionInputObject.CollectionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, CollectionInputObject) ); + } + await this.Client.PrivateStoreCollectionOfferCreateOrUpdate(CollectionInputObject.PrivateStoreId ?? null, CollectionInputObject.CollectionId ?? null, OfferId, _payloadBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityPrivateStore.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityPrivateStore.cs new file mode 100644 index 000000000000..c36c6dc93b79 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityPrivateStore.cs @@ -0,0 +1,491 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Update or add an offer to a specific collection of the private store. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityPrivateStore", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Update or add an offer to a specific collection of the private store.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}", ApiVersion = "2023-01-01")] + public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityPrivateStore : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer _payload; + + /// The privateStore offer data structure. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The privateStore offer data structure.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The privateStore offer data structure.", + SerializedName = @"payload", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer Payload { get => this._payload; set => this._payload = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _privateStoreInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity PrivateStoreInputObject { get => this._privateStoreInputObject; set => this._privateStoreInputObject = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityPrivateStore() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (PrivateStoreInputObject?.Id != null) + { + this.PrivateStoreInputObject.Id += $"/collections/{(global::System.Uri.EscapeDataString(this.CollectionId.ToString()))}/offers/{(global::System.Uri.EscapeDataString(this.OfferId.ToString()))}"; + await this.Client.PrivateStoreCollectionOfferCreateOrUpdateViaIdentity(PrivateStoreInputObject.Id, Payload, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == PrivateStoreInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("PrivateStoreInputObject has null value for PrivateStoreInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, PrivateStoreInputObject) ); + } + await this.Client.PrivateStoreCollectionOfferCreateOrUpdate(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, OfferId, Payload, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { CollectionId=CollectionId,OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityPrivateStoreExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityPrivateStoreExpanded.cs new file mode 100644 index 000000000000..fe7cf2585901 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityPrivateStoreExpanded.cs @@ -0,0 +1,541 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Update or add an offer to a specific collection of the private store. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityPrivateStoreExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Update or add an offer to a specific collection of the private store.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}", ApiVersion = "2023-01-01")] + public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityPrivateStoreExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// The privateStore offer data structure. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Offer(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Identifier for purposes of race condition + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Identifier for purposes of race condition")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Identifier for purposes of race condition", + SerializedName = @"eTag", + PossibleTypes = new [] { typeof(string) })] + public string ETag { get => _payloadBody.ETag ?? null; set => _payloadBody.ETag = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Icon File Uris + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Icon File Uris")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Icon File Uris", + SerializedName = @"iconFileUris", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris IconFileUri { get => _payloadBody.IconFileUri ?? null /* object */; set => _payloadBody.IconFileUri = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Offer plans + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Offer plans")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Offer plans", + SerializedName = @"plans", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[] Plan { get => _payloadBody.Plan?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.Plan = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _privateStoreInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity PrivateStoreInputObject { get => this._privateStoreInputObject; set => this._privateStoreInputObject = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Plan ids limitation for this offer + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Plan ids limitation for this offer")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Plan ids limitation for this offer", + SerializedName = @"specificPlanIdsLimitation", + PossibleTypes = new [] { typeof(string) })] + public string[] SpecificPlanIdLimitation { get => _payloadBody.SpecificPlanIdsLimitation?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SpecificPlanIdsLimitation = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed + /// one in db, the offer would not be updated. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated.", + SerializedName = @"updateSuppressedDueIdempotence", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter UpdateSuppressedDueIdempotence { get => _payloadBody.UpdateSuppressedDueIdempotence ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.UpdateSuppressedDueIdempotence = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzMarketplacePrivateStoreCollectionOffer_CreateViaIdentityPrivateStoreExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (PrivateStoreInputObject?.Id != null) + { + this.PrivateStoreInputObject.Id += $"/collections/{(global::System.Uri.EscapeDataString(this.CollectionId.ToString()))}/offers/{(global::System.Uri.EscapeDataString(this.OfferId.ToString()))}"; + await this.Client.PrivateStoreCollectionOfferCreateOrUpdateViaIdentity(PrivateStoreInputObject.Id, _payloadBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == PrivateStoreInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("PrivateStoreInputObject has null value for PrivateStoreInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, PrivateStoreInputObject) ); + } + await this.Client.PrivateStoreCollectionOfferCreateOrUpdate(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, OfferId, _payloadBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { CollectionId=CollectionId,OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaJsonFilePath.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaJsonFilePath.cs new file mode 100644 index 000000000000..922378041215 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaJsonFilePath.cs @@ -0,0 +1,486 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Update or add an offer to a specific collection of the private store. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStoreCollectionOffer_CreateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Update or add an offer to a specific collection of the private store.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}", ApiVersion = "2023-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.NotSuggestDefaultParameterSet] + public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + public global::System.String _jsonString; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Create operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public NewAzMarketplacePrivateStoreCollectionOffer_CreateViaJsonFilePath() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCollectionOfferCreateOrUpdateViaJsonString(PrivateStoreId, CollectionId, OfferId, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId,OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaJsonString.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaJsonString.cs new file mode 100644 index 000000000000..d2976e2efc4c --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollectionOffer_CreateViaJsonString.cs @@ -0,0 +1,484 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Update or add an offer to a specific collection of the private store. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStoreCollectionOffer_CreateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Update or add an offer to a specific collection of the private store.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}", ApiVersion = "2023-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.NotSuggestDefaultParameterSet] + public partial class NewAzMarketplacePrivateStoreCollectionOffer_CreateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Create operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public NewAzMarketplacePrivateStoreCollectionOffer_CreateViaJsonString() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCollectionOfferCreateOrUpdateViaJsonString(PrivateStoreId, CollectionId, OfferId, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId,OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateExpanded.cs index 2f599c7682e9..a4a34d995942 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateExpanded.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateExpanded.cs @@ -6,18 +6,22 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; - /// Create or update private store collection + /// Create private store collection /// /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStoreCollection_CreateExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection))] - [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Create or update private store collection")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Create private store collection")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}", ApiVersion = "2023-01-01")] public partial class NewAzMarketplacePrivateStoreCollection_CreateExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,6 +37,21 @@ public partial class NewAzMarketplacePrivateStoreCollection_CreateExpanded : glo /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// The Collection data structure. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Collection(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Indicating whether all subscriptions are selected (=true) or not (=false). [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicating whether all subscriptions are selected (=true) or not (=false).")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] @@ -42,13 +61,16 @@ public partial class NewAzMarketplacePrivateStoreCollection_CreateExpanded : glo Description = @"Indicating whether all subscriptions are selected (=true) or not (=false).", SerializedName = @"allSubscriptions", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] - public global::System.Management.Automation.SwitchParameter AllSubscription { get => PayloadBody.AllSubscription ?? default(global::System.Management.Automation.SwitchParameter); set => PayloadBody.AllSubscription = value; } + public global::System.Management.Automation.SwitchParameter AllSubscription { get => _payloadBody.AllSubscription ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.AllSubscription = value; } /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// Gets or sets the association with Commercial's Billing Account. [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the association with Commercial's Billing Account.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] @@ -58,7 +80,7 @@ public partial class NewAzMarketplacePrivateStoreCollection_CreateExpanded : glo Description = @"Gets or sets the association with Commercial's Billing Account.", SerializedName = @"claim", PossibleTypes = new [] { typeof(string) })] - public string Claim { get => PayloadBody.Claim ?? null; set => PayloadBody.Claim = value; } + public string Claim { get => _payloadBody.Claim ?? null; set => _payloadBody.Claim = value; } /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; @@ -86,12 +108,13 @@ public partial class NewAzMarketplacePrivateStoreCollection_CreateExpanded : glo Description = @"Gets or sets collection name.", SerializedName = @"collectionName", PossibleTypes = new [] { typeof(string) })] - public string CollectionName { get => PayloadBody.CollectionName ?? null; set => PayloadBody.CollectionName = value; } + public string CollectionName { get => _payloadBody.CollectionName ?? null; set => _payloadBody.CollectionName = value; } /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] @@ -106,7 +129,10 @@ public partial class NewAzMarketplacePrivateStoreCollection_CreateExpanded : glo Description = @"Indicating whether the collection is enabled or disabled.", SerializedName = @"enabled", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] - public global::System.Management.Automation.SwitchParameter Enabled { get => PayloadBody.Enabled ?? default(global::System.Management.Automation.SwitchParameter); set => PayloadBody.Enabled = value; } + public global::System.Management.Automation.SwitchParameter Enabled { get => _payloadBody.Enabled ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.Enabled = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] @@ -124,23 +150,17 @@ public partial class NewAzMarketplacePrivateStoreCollection_CreateExpanded : glo public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection _payloadBody= new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Collection(); - - /// The Collection data structure. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection PayloadBody { get => this._payloadBody; set => this._payloadBody = value; } - /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Backing field for property. private string _privateStoreId; @@ -185,37 +205,42 @@ public partial class NewAzMarketplacePrivateStoreCollection_CreateExpanded : glo Description = @"Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request", SerializedName = @"subscriptionsList", PossibleTypes = new [] { typeof(string) })] - public string[] SubscriptionsList { get => PayloadBody.SubscriptionsList ?? null /* arrayOf */; set => PayloadBody.SubscriptionsList = value; } + public string[] SubscriptionsList { get => _payloadBody.SubscriptionsList?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SubscriptionsList = (value != null ? new System.Collections.Generic.List(value) : null); } /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -227,7 +252,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// Handles/Dispatches events during the call to the REST service. @@ -274,8 +303,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -285,7 +339,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public NewAzMarketplacePrivateStoreCollection_CreateExpanded() { @@ -338,9 +392,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -353,12 +406,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.PrivateStoreCollectionCreateOrUpdate(PrivateStoreId, CollectionId, PayloadBody, onOk, onDefault, this, Pipeline); + await this.Client.PrivateStoreCollectionCreateOrUpdate(PrivateStoreId, CollectionId, _payloadBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId,body=PayloadBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -381,12 +434,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -403,15 +456,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, CollectionId=CollectionId, body=PayloadBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, CollectionId=CollectionId, body=PayloadBody }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -421,12 +474,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -438,8 +491,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateViaIdentity.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateViaIdentity.cs index 04236ddb3139..8a349e64fea0 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateViaIdentity.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateViaIdentity.cs @@ -6,19 +6,23 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; - /// Create or update private store collection + /// Create private store collection /// /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" /// [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStoreCollection_CreateViaIdentity", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection))] - [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Create or update private store collection")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Create private store collection")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}", ApiVersion = "2023-01-01")] public partial class NewAzMarketplacePrivateStoreCollection_CreateViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,23 +38,42 @@ public partial class NewAzMarketplacePrivateStoreCollection_CreateViaIdentity : /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -75,15 +98,15 @@ public partial class NewAzMarketplacePrivateStoreCollection_CreateViaIdentity : public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection _payload; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection _payload; /// The Collection data structure. [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Collection data structure.", ValueFromPipeline = true)] @@ -92,13 +115,14 @@ public partial class NewAzMarketplacePrivateStoreCollection_CreateViaIdentity : ReadOnly = false, Description = @"The Collection data structure.", SerializedName = @"payload", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection) })] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection Payload { get => this._payload; set => this._payload = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection Payload { get => this._payload; set => this._payload = value; } /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -121,30 +145,35 @@ public partial class NewAzMarketplacePrivateStoreCollection_CreateViaIdentity : /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -156,7 +185,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// Handles/Dispatches events during the call to the REST service. @@ -203,8 +236,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -214,7 +272,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public NewAzMarketplacePrivateStoreCollection_CreateViaIdentity() { @@ -267,9 +325,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -284,7 +341,7 @@ protected override void ProcessRecord() await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } if (InputObject?.Id != null) { - await this.Client.PrivateStoreCollectionCreateOrUpdateViaIdentity(InputObject.Id, Payload, onOk, onDefault, this, Pipeline); + await this.Client.PrivateStoreCollectionCreateOrUpdateViaIdentity(InputObject.Id, Payload, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); } else { @@ -297,13 +354,13 @@ protected override void ProcessRecord() { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.CollectionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); } - await this.Client.PrivateStoreCollectionCreateOrUpdate(InputObject.PrivateStoreId ?? null, InputObject.CollectionId ?? null, Payload, onOk, onDefault, this, Pipeline); + await this.Client.PrivateStoreCollectionCreateOrUpdate(InputObject.PrivateStoreId ?? null, InputObject.CollectionId ?? null, Payload, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Payload}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -326,12 +383,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -348,15 +405,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Payload }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Payload }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -366,12 +423,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -383,8 +440,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateViaIdentityPrivateStore.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateViaIdentityPrivateStore.cs new file mode 100644 index 000000000000..72806bc975ad --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateViaIdentityPrivateStore.cs @@ -0,0 +1,477 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Create private store collection + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStoreCollection_CreateViaIdentityPrivateStore", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Create private store collection")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}", ApiVersion = "2023-01-01")] + public partial class NewAzMarketplacePrivateStoreCollection_CreateViaIdentityPrivateStore : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection _payload; + + /// The Collection data structure. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Collection data structure.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Collection data structure.", + SerializedName = @"payload", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection Payload { get => this._payload; set => this._payload = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _privateStoreInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity PrivateStoreInputObject { get => this._privateStoreInputObject; set => this._privateStoreInputObject = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the + /// cmdlet class. + /// + public NewAzMarketplacePrivateStoreCollection_CreateViaIdentityPrivateStore() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (PrivateStoreInputObject?.Id != null) + { + this.PrivateStoreInputObject.Id += $"/collections/{(global::System.Uri.EscapeDataString(this.CollectionId.ToString()))}"; + await this.Client.PrivateStoreCollectionCreateOrUpdateViaIdentity(PrivateStoreInputObject.Id, Payload, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == PrivateStoreInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("PrivateStoreInputObject has null value for PrivateStoreInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, PrivateStoreInputObject) ); + } + await this.Client.PrivateStoreCollectionCreateOrUpdate(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, Payload, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateViaIdentityPrivateStoreExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateViaIdentityPrivateStoreExpanded.cs new file mode 100644 index 000000000000..d2a4e94bddaa --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateViaIdentityPrivateStoreExpanded.cs @@ -0,0 +1,525 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Create private store collection + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStoreCollection_CreateViaIdentityPrivateStoreExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Create private store collection")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}", ApiVersion = "2023-01-01")] + public partial class NewAzMarketplacePrivateStoreCollection_CreateViaIdentityPrivateStoreExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// The Collection data structure. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Collection(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Indicating whether all subscriptions are selected (=true) or not (=false). + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicating whether all subscriptions are selected (=true) or not (=false).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicating whether all subscriptions are selected (=true) or not (=false).", + SerializedName = @"allSubscriptions", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter AllSubscription { get => _payloadBody.AllSubscription ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.AllSubscription = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// Gets or sets the association with Commercial's Billing Account. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the association with Commercial's Billing Account.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the association with Commercial's Billing Account.", + SerializedName = @"claim", + PossibleTypes = new [] { typeof(string) })] + public string Claim { get => _payloadBody.Claim ?? null; set => _payloadBody.Claim = value; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// Gets or sets collection name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets collection name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets collection name.", + SerializedName = @"collectionName", + PossibleTypes = new [] { typeof(string) })] + public string CollectionName { get => _payloadBody.CollectionName ?? null; set => _payloadBody.CollectionName = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Indicating whether the collection is enabled or disabled. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicating whether the collection is enabled or disabled.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicating whether the collection is enabled or disabled.", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter Enabled { get => _payloadBody.Enabled ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.Enabled = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _privateStoreInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity PrivateStoreInputObject { get => this._privateStoreInputObject; set => this._privateStoreInputObject = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, + /// explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request", + SerializedName = @"subscriptionsList", + PossibleTypes = new [] { typeof(string) })] + public string[] SubscriptionsList { get => _payloadBody.SubscriptionsList?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SubscriptionsList = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzMarketplacePrivateStoreCollection_CreateViaIdentityPrivateStoreExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (PrivateStoreInputObject?.Id != null) + { + this.PrivateStoreInputObject.Id += $"/collections/{(global::System.Uri.EscapeDataString(this.CollectionId.ToString()))}"; + await this.Client.PrivateStoreCollectionCreateOrUpdateViaIdentity(PrivateStoreInputObject.Id, _payloadBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); + } + else + { + // try to call with PATH parameters from Input Object + if (null == PrivateStoreInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("PrivateStoreInputObject has null value for PrivateStoreInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, PrivateStoreInputObject) ); + } + await this.Client.PrivateStoreCollectionCreateOrUpdate(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, _payloadBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateViaJsonFilePath.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateViaJsonFilePath.cs new file mode 100644 index 000000000000..44a550330f36 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateViaJsonFilePath.cs @@ -0,0 +1,471 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Create private store collection + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStoreCollection_CreateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Create private store collection")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}", ApiVersion = "2023-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.NotSuggestDefaultParameterSet] + public partial class NewAzMarketplacePrivateStoreCollection_CreateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + public global::System.String _jsonString; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Create operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzMarketplacePrivateStoreCollection_CreateViaJsonFilePath() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCollectionCreateOrUpdateViaJsonString(PrivateStoreId, CollectionId, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateViaJsonString.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateViaJsonString.cs new file mode 100644 index 000000000000..721830353350 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStoreCollection_CreateViaJsonString.cs @@ -0,0 +1,469 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Create private store collection + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStoreCollection_CreateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Create private store collection")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}", ApiVersion = "2023-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.NotSuggestDefaultParameterSet] + public partial class NewAzMarketplacePrivateStoreCollection_CreateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Create operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzMarketplacePrivateStoreCollection_CreateViaJsonString() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCollectionCreateOrUpdateViaJsonString(PrivateStoreId, CollectionId, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStore_CreateExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStore_CreateExpanded.cs index 66208caa6b97..ae44d9b5f691 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStore_CreateExpanded.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStore_CreateExpanded.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Changes private store properties @@ -16,8 +18,10 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Changes private store properties")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}", ApiVersion = "2023-01-01")] public partial class NewAzMarketplacePrivateStore_CreateExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,6 +37,21 @@ public partial class NewAzMarketplacePrivateStore_CreateExpanded : global::Syste /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// The PrivateStore data structure. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStore(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Indicates private store availability [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates private store availability")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] @@ -41,9 +60,9 @@ public partial class NewAzMarketplacePrivateStore_CreateExpanded : global::Syste ReadOnly = false, Description = @"Indicates private store availability", SerializedName = @"availability", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability) })] - [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability))] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability Availability { get => PayloadBody.Availability ?? ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability)""); set => PayloadBody.Availability = value; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("enabled", "disabled")] + public string Availability { get => _payloadBody.Availability ?? null; set => _payloadBody.Availability = value; } /// Gets or sets list of branding characteristics [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ExportAs(typeof(global::System.Collections.Hashtable))] @@ -54,21 +73,25 @@ public partial class NewAzMarketplacePrivateStore_CreateExpanded : global::Syste ReadOnly = false, Description = @"Gets or sets list of branding characteristics", SerializedName = @"branding", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding) })] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding Branding { get => PayloadBody.Branding ?? null /* object */; set => PayloadBody.Branding = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding Branding { get => _payloadBody.Branding ?? null /* object */; set => _payloadBody.Branding = value; } /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] @@ -83,7 +106,10 @@ public partial class NewAzMarketplacePrivateStore_CreateExpanded : global::Syste Description = @"Identifier for purposes of race condition", SerializedName = @"eTag", PossibleTypes = new [] { typeof(string) })] - public string ETag { get => PayloadBody.ETag ?? null; set => PayloadBody.ETag = value; } + public string ETag { get => _payloadBody.ETag ?? null; set => _payloadBody.ETag = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] @@ -124,14 +150,14 @@ public partial class NewAzMarketplacePrivateStore_CreateExpanded : global::Syste Description = @"Is government", SerializedName = @"isGov", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] - public global::System.Management.Automation.SwitchParameter IsGov { get => PayloadBody.IsGov ?? default(global::System.Management.Automation.SwitchParameter); set => PayloadBody.IsGov = value; } + public global::System.Management.Automation.SwitchParameter IsGov { get => _payloadBody.IsGov ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.IsGov = value; } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// Gets or sets list of notified recipients for new requests @@ -143,8 +169,8 @@ public partial class NewAzMarketplacePrivateStore_CreateExpanded : global::Syste ReadOnly = false, Description = @"Gets or sets list of notified recipients for new requests", SerializedName = @"recipients", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient) })] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[] NotificationSettingRecipient { get => PayloadBody.NotificationSettingRecipient ?? null /* arrayOf */; set => PayloadBody.NotificationSettingRecipient = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient[] NotificationSettingRecipient { get => _payloadBody.NotificationSettingRecipient?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.NotificationSettingRecipient = (value != null ? new System.Collections.Generic.List(value) : null); } /// Gets or sets whether to send email to all marketplace admins for new requests [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets whether to send email to all marketplace admins for new requests")] @@ -155,7 +181,7 @@ public partial class NewAzMarketplacePrivateStore_CreateExpanded : global::Syste Description = @"Gets or sets whether to send email to all marketplace admins for new requests", SerializedName = @"sendToAllMarketplaceAdmins", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] - public global::System.Management.Automation.SwitchParameter NotificationSettingSendToAllMarketplaceAdmin { get => PayloadBody.NotificationSettingSendToAllMarketplaceAdmin ?? default(global::System.Management.Automation.SwitchParameter); set => PayloadBody.NotificationSettingSendToAllMarketplaceAdmin = value; } + public global::System.Management.Automation.SwitchParameter NotificationSettingSendToAllMarketplaceAdmin { get => _payloadBody.NotificationSettingSendToAllMarketplaceAdmin ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.NotificationSettingSendToAllMarketplaceAdmin = value; } /// /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. @@ -164,16 +190,10 @@ public partial class NewAzMarketplacePrivateStore_CreateExpanded : global::Syste [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter PassThru { get; set; } - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore _payloadBody= new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStore(); - - /// The PrivateStore data structure. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore PayloadBody { get => this._payloadBody; set => this._payloadBody = value; } - /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Private Store Name [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Private Store Name")] @@ -184,7 +204,7 @@ public partial class NewAzMarketplacePrivateStore_CreateExpanded : global::Syste Description = @"Private Store Name", SerializedName = @"privateStoreName", PossibleTypes = new [] { typeof(string) })] - public string PrivateStoreName { get => PayloadBody.PrivateStoreName ?? null; set => PayloadBody.PrivateStoreName = value; } + public string PrivateStoreName { get => _payloadBody.PrivateStoreName ?? null; set => _payloadBody.PrivateStoreName = value; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -211,19 +231,19 @@ public partial class NewAzMarketplacePrivateStore_CreateExpanded : global::Syste Description = @"Tenant id", SerializedName = @"tenantId", PossibleTypes = new [] { typeof(string) })] - public string TenantId { get => PayloadBody.TenantId ?? null; set => PayloadBody.TenantId = value; } + public string TenantId { get => _payloadBody.TenantId ?? null; set => _payloadBody.TenantId = value; } /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens @@ -240,6 +260,11 @@ public partial class NewAzMarketplacePrivateStore_CreateExpanded : global::Syste /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -251,7 +276,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// Handles/Dispatches events during the call to the REST service. @@ -298,8 +327,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -309,7 +363,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public NewAzMarketplacePrivateStore_CreateExpanded() { @@ -362,9 +416,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -377,12 +430,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.PrivateStoreCreateOrUpdate(Id, PayloadBody, onOk, onDefault, this, Pipeline); + await this.Client.PrivateStoreCreateOrUpdate(Id, _payloadBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Id=Id,body=PayloadBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Id=Id}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -405,12 +458,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -427,15 +480,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Id=Id, body=PayloadBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Id=Id, body=PayloadBody }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStore_CreateViaIdentity.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStore_CreateViaIdentity.cs index da65e04efbf1..bea6dbc7b56b 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStore_CreateViaIdentity.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStore_CreateViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Changes private store properties @@ -17,8 +19,10 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Changes private store properties")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}", ApiVersion = "2023-01-01")] public partial class NewAzMarketplacePrivateStore_CreateViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -34,23 +38,42 @@ public partial class NewAzMarketplacePrivateStore_CreateViaIdentity : global::Sy /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -75,11 +98,11 @@ public partial class NewAzMarketplacePrivateStore_CreateViaIdentity : global::Sy public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// @@ -90,7 +113,7 @@ public partial class NewAzMarketplacePrivateStore_CreateViaIdentity : global::Sy public global::System.Management.Automation.SwitchParameter PassThru { get; set; } /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore _payload; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore _payload; /// The PrivateStore data structure. [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The PrivateStore data structure.", ValueFromPipeline = true)] @@ -99,13 +122,14 @@ public partial class NewAzMarketplacePrivateStore_CreateViaIdentity : global::Sy ReadOnly = false, Description = @"The PrivateStore data structure.", SerializedName = @"payload", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore) })] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore Payload { get => this._payload; set => this._payload = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore Payload { get => this._payload; set => this._payload = value; } /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -128,12 +152,12 @@ public partial class NewAzMarketplacePrivateStore_CreateViaIdentity : global::Sy /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens @@ -150,6 +174,11 @@ public partial class NewAzMarketplacePrivateStore_CreateViaIdentity : global::Sy /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -161,7 +190,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// Handles/Dispatches events during the call to the REST service. @@ -208,8 +241,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -219,7 +277,7 @@ protected override void EndProcessing() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public NewAzMarketplacePrivateStore_CreateViaIdentity() { @@ -272,9 +330,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -289,7 +346,7 @@ protected override void ProcessRecord() await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } if (InputObject?.Id != null) { - await this.Client.PrivateStoreCreateOrUpdateViaIdentity(InputObject.Id, Payload, onOk, onDefault, this, Pipeline); + await this.Client.PrivateStoreCreateOrUpdateViaIdentity(InputObject.Id, Payload, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); } else { @@ -298,13 +355,13 @@ protected override void ProcessRecord() { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); } - await this.Client.PrivateStoreCreateOrUpdate(InputObject.PrivateStoreId ?? null, Payload, onOk, onDefault, this, Pipeline); + await this.Client.PrivateStoreCreateOrUpdate(InputObject.PrivateStoreId ?? null, Payload, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SerializationMode.IncludeCreate); } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Payload}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -327,12 +384,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -349,15 +406,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Payload }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Payload }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStore_CreateViaJsonFilePath.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStore_CreateViaJsonFilePath.cs new file mode 100644 index 000000000000..87d982a0b43e --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStore_CreateViaJsonFilePath.cs @@ -0,0 +1,445 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Changes private store properties + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStore_CreateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Changes private store properties")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}", ApiVersion = "2023-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.NotSuggestDefaultParameterSet] + public partial class NewAzMarketplacePrivateStore_CreateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + public global::System.String _jsonString; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private string _id; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PrivateStoreId")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string Id { get => this._id; set => this._id = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Create operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzMarketplacePrivateStore_CreateViaJsonFilePath() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCreateOrUpdateViaJsonString(Id, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Id=Id}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStore_CreateViaJsonString.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStore_CreateViaJsonString.cs new file mode 100644 index 000000000000..9d9d60032bd7 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/NewAzMarketplacePrivateStore_CreateViaJsonString.cs @@ -0,0 +1,443 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Changes private store properties + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMarketplacePrivateStore_CreateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Changes private store properties")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}", ApiVersion = "2023-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.NotSuggestDefaultParameterSet] + public partial class NewAzMarketplacePrivateStore_CreateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private string _id; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PrivateStoreId")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string Id { get => this._id; set => this._id = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Create operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Create operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Create operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public NewAzMarketplacePrivateStore_CreateViaJsonString() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCreateOrUpdateViaJsonString(Id, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Id=Id}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollectionOffer_Delete.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollectionOffer_Delete.cs index daa84e7bedba..e2a5194d89bd 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollectionOffer_Delete.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollectionOffer_Delete.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Deletes an offer from the given collection of private store. @@ -16,8 +18,10 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Deletes an offer from the given collection of private store.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}", ApiVersion = "2023-01-01")] public partial class RemoveAzMarketplacePrivateStoreCollectionOffer_Delete : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,11 +37,26 @@ public partial class RemoveAzMarketplacePrivateStoreCollectionOffer_Delete : glo /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; @@ -56,14 +75,18 @@ public partial class RemoveAzMarketplacePrivateStoreCollectionOffer_Delete : glo public string CollectionId { get => this._collectionId; set => this._collectionId = value; } /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -80,11 +103,11 @@ public partial class RemoveAzMarketplacePrivateStoreCollectionOffer_Delete : glo public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// Backing field for property. @@ -111,7 +134,7 @@ public partial class RemoveAzMarketplacePrivateStoreCollectionOffer_Delete : glo /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Backing field for property. private string _privateStoreId; @@ -148,12 +171,12 @@ public partial class RemoveAzMarketplacePrivateStoreCollectionOffer_Delete : glo /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of @@ -180,6 +203,11 @@ public partial class RemoveAzMarketplacePrivateStoreCollectionOffer_Delete : glo /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -191,7 +219,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// Handles/Dispatches events during the call to the REST service. @@ -238,8 +270,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -294,9 +351,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -309,12 +365,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.PrivateStoreCollectionOfferDelete(PrivateStoreId, OfferId, CollectionId, onOk, onNoContent, onDefault, this, Pipeline); + await this.Client.PrivateStoreCollectionOfferDelete(PrivateStoreId, CollectionId, OfferId, onOk, onNoContent, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,OfferId=OfferId,CollectionId=CollectionId}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId,OfferId=OfferId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -327,7 +383,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public RemoveAzMarketplacePrivateStoreCollectionOffer_Delete() { @@ -345,12 +401,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -367,15 +423,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, OfferId=OfferId, CollectionId=CollectionId }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, OfferId=OfferId, CollectionId=CollectionId }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentity.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentity.cs index fe0723bbcce8..9a38cf4ceb1f 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentity.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Deletes an offer from the given collection of private store. @@ -16,8 +18,10 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Deletes an offer from the given collection of private store.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}", ApiVersion = "2023-01-01")] public partial class RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,23 +37,42 @@ public partial class RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIde /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -74,11 +97,11 @@ public partial class RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIde public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// @@ -91,7 +114,7 @@ public partial class RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIde /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -114,12 +137,12 @@ public partial class RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIde /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of @@ -146,6 +169,11 @@ public partial class RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIde /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -157,7 +185,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// Handles/Dispatches events during the call to the REST service. @@ -204,8 +236,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -260,9 +317,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -286,21 +342,21 @@ protected override void ProcessRecord() { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); } - if (null == InputObject.OfferId) - { - ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.OfferId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); - } if (null == InputObject.CollectionId) { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.CollectionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); } - await this.Client.PrivateStoreCollectionOfferDelete(InputObject.PrivateStoreId ?? null, InputObject.OfferId ?? null, InputObject.CollectionId ?? null, onOk, onNoContent, onDefault, this, Pipeline); + if (null == InputObject.OfferId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.OfferId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PrivateStoreCollectionOfferDelete(InputObject.PrivateStoreId ?? null, InputObject.CollectionId ?? null, InputObject.OfferId ?? null, onOk, onNoContent, onDefault, this, Pipeline); } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -313,7 +369,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet + /// Initializes a new instance of the cmdlet /// class. /// public RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentity() @@ -332,12 +388,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -354,7 +410,7 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentityCollection.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentityCollection.cs new file mode 100644 index 000000000000..2730f6ecb076 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentityCollection.cs @@ -0,0 +1,488 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Deletes an offer from the given collection of private store. + /// + /// [OpenAPI] Delete=>DELETE:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentityCollection", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Deletes an offer from the given collection of private store.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}", ApiVersion = "2023-01-01")] + public partial class RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentityCollection : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _collectionInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity CollectionInputObject { get => this._collectionInputObject; set => this._collectionInputObject = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (CollectionInputObject?.Id != null) + { + this.CollectionInputObject.Id += $"/offers/{(global::System.Uri.EscapeDataString(this.OfferId.ToString()))}"; + await this.Client.PrivateStoreCollectionOfferDeleteViaIdentity(CollectionInputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == CollectionInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("CollectionInputObject has null value for CollectionInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, CollectionInputObject) ); + } + if (null == CollectionInputObject.CollectionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("CollectionInputObject has null value for CollectionInputObject.CollectionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, CollectionInputObject) ); + } + await this.Client.PrivateStoreCollectionOfferDelete(CollectionInputObject.PrivateStoreId ?? null, CollectionInputObject.CollectionId ?? null, OfferId, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentityCollection() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentityPrivateStore.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentityPrivateStore.cs new file mode 100644 index 000000000000..5f85e431ce58 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentityPrivateStore.cs @@ -0,0 +1,498 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Deletes an offer from the given collection of private store. + /// + /// [OpenAPI] Delete=>DELETE:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentityPrivateStore", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Deletes an offer from the given collection of private store.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}", ApiVersion = "2023-01-01")] + public partial class RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentityPrivateStore : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _privateStoreInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity PrivateStoreInputObject { get => this._privateStoreInputObject; set => this._privateStoreInputObject = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (PrivateStoreInputObject?.Id != null) + { + this.PrivateStoreInputObject.Id += $"/collections/{(global::System.Uri.EscapeDataString(this.CollectionId.ToString()))}/offers/{(global::System.Uri.EscapeDataString(this.OfferId.ToString()))}"; + await this.Client.PrivateStoreCollectionOfferDeleteViaIdentity(PrivateStoreInputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == PrivateStoreInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("PrivateStoreInputObject has null value for PrivateStoreInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, PrivateStoreInputObject) ); + } + await this.Client.PrivateStoreCollectionOfferDelete(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, OfferId, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { CollectionId=CollectionId,OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public RemoveAzMarketplacePrivateStoreCollectionOffer_DeleteViaIdentityPrivateStore() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollection_Delete.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollection_Delete.cs index 06e5eeb40a5a..d9578f0d05d3 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollection_Delete.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollection_Delete.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Delete a collection from the given private store. @@ -16,8 +18,10 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Delete a collection from the given private store.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}", ApiVersion = "2023-01-01")] public partial class RemoveAzMarketplacePrivateStoreCollection_Delete : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,11 +37,26 @@ public partial class RemoveAzMarketplacePrivateStoreCollection_Delete : global:: /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; @@ -56,14 +75,18 @@ public partial class RemoveAzMarketplacePrivateStoreCollection_Delete : global:: public string CollectionId { get => this._collectionId; set => this._collectionId = value; } /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -80,11 +103,11 @@ public partial class RemoveAzMarketplacePrivateStoreCollection_Delete : global:: public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// @@ -97,7 +120,7 @@ public partial class RemoveAzMarketplacePrivateStoreCollection_Delete : global:: /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Backing field for property. private string _privateStoreId; @@ -134,12 +157,12 @@ public partial class RemoveAzMarketplacePrivateStoreCollection_Delete : global:: /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of @@ -166,6 +189,11 @@ public partial class RemoveAzMarketplacePrivateStoreCollection_Delete : global:: /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -177,7 +205,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// Handles/Dispatches events during the call to the REST service. @@ -224,8 +256,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -280,9 +337,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -300,7 +356,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -313,7 +369,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public RemoveAzMarketplacePrivateStoreCollection_Delete() { @@ -331,12 +387,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -353,15 +409,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, CollectionId=CollectionId }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, CollectionId=CollectionId }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollection_DeleteViaIdentity.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollection_DeleteViaIdentity.cs index ceb5af830036..46ad76053ba4 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollection_DeleteViaIdentity.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollection_DeleteViaIdentity.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Delete a collection from the given private store. @@ -16,8 +18,10 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Delete a collection from the given private store.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}", ApiVersion = "2023-01-01")] public partial class RemoveAzMarketplacePrivateStoreCollection_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,23 +37,42 @@ public partial class RemoveAzMarketplacePrivateStoreCollection_DeleteViaIdentity /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -74,11 +97,11 @@ public partial class RemoveAzMarketplacePrivateStoreCollection_DeleteViaIdentity public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// @@ -91,7 +114,7 @@ public partial class RemoveAzMarketplacePrivateStoreCollection_DeleteViaIdentity /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -114,12 +137,12 @@ public partial class RemoveAzMarketplacePrivateStoreCollection_DeleteViaIdentity /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of @@ -146,6 +169,11 @@ public partial class RemoveAzMarketplacePrivateStoreCollection_DeleteViaIdentity /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -157,7 +185,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// Handles/Dispatches events during the call to the REST service. @@ -204,8 +236,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -260,9 +317,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -296,7 +352,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -309,7 +365,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public RemoveAzMarketplacePrivateStoreCollection_DeleteViaIdentity() { @@ -327,12 +383,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -349,7 +405,7 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollection_DeleteViaIdentityPrivateStore.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollection_DeleteViaIdentityPrivateStore.cs new file mode 100644 index 000000000000..e9bc4b51e326 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/RemoveAzMarketplacePrivateStoreCollection_DeleteViaIdentityPrivateStore.cs @@ -0,0 +1,484 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Delete a collection from the given private store. + /// + /// [OpenAPI] Delete=>DELETE:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzMarketplacePrivateStoreCollection_DeleteViaIdentityPrivateStore", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Delete a collection from the given private store.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}", ApiVersion = "2023-01-01")] + public partial class RemoveAzMarketplacePrivateStoreCollection_DeleteViaIdentityPrivateStore : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _privateStoreInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity PrivateStoreInputObject { get => this._privateStoreInputObject; set => this._privateStoreInputObject = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (PrivateStoreInputObject?.Id != null) + { + this.PrivateStoreInputObject.Id += $"/collections/{(global::System.Uri.EscapeDataString(this.CollectionId.ToString()))}"; + await this.Client.PrivateStoreCollectionDeleteViaIdentity(PrivateStoreInputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == PrivateStoreInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("PrivateStoreInputObject has null value for PrivateStoreInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, PrivateStoreInputObject) ); + } + await this.Client.PrivateStoreCollectionDelete(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public RemoveAzMarketplacePrivateStoreCollection_DeleteViaIdentityPrivateStore() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplaceBulkPrivateStoreCollectionAction_Bulk.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplaceBulkPrivateStoreCollectionAction_Bulk.cs index 054ff7d181c5..d9ca1526e296 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplaceBulkPrivateStoreCollectionAction_Bulk.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplaceBulkPrivateStoreCollectionAction_Bulk.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Perform an action on bulk collections @@ -13,11 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] BulkCollectionsAction=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/bulkCollectionsAction" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzMarketplaceBulkPrivateStoreCollectionAction_Bulk", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponse))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Perform an action on bulk collections")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/bulkCollectionsAction", ApiVersion = "2023-01-01")] public partial class SetAzMarketplaceBulkPrivateStoreCollectionAction_Bulk : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,23 +37,42 @@ public partial class SetAzMarketplaceBulkPrivateStoreCollectionAction_Bulk : glo /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -66,15 +89,15 @@ public partial class SetAzMarketplaceBulkPrivateStoreCollectionAction_Bulk : glo public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload _payload; + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload _payload; /// Bulk collections action properties [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Bulk collections action properties", ValueFromPipeline = true)] @@ -83,13 +106,14 @@ public partial class SetAzMarketplaceBulkPrivateStoreCollectionAction_Bulk : glo ReadOnly = false, Description = @"Bulk collections action properties", SerializedName = @"payload", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload) })] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload Payload { get => this._payload; set => this._payload = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload Payload { get => this._payload; set => this._payload = value; } /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Backing field for property. private string _privateStoreId; @@ -126,30 +150,35 @@ public partial class SetAzMarketplaceBulkPrivateStoreCollectionAction_Bulk : glo /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -161,7 +190,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// Handles/Dispatches events during the call to the REST service. @@ -208,8 +241,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -264,9 +322,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -284,7 +341,7 @@ protected override void ProcessRecord() } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,body=Payload}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -297,7 +354,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public SetAzMarketplaceBulkPrivateStoreCollectionAction_Bulk() { @@ -315,12 +372,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -337,15 +394,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, body=Payload }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, body=Payload }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -355,12 +412,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -372,8 +429,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponse - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkExpanded.cs index 763b1500980f..d0e70dca15b4 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkExpanded.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkExpanded.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Perform an action on bulk collections @@ -13,11 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] BulkCollectionsAction=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/bulkCollectionsAction" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzMarketplaceBulkPrivateStoreCollectionAction_BulkExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponse))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Perform an action on bulk collections")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/bulkCollectionsAction", ApiVersion = "2023-01-01")] public partial class SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,6 +37,21 @@ public partial class SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkExpand /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// Bulk collections action properties + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.BulkCollectionsPayload(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Action to perform (For example: EnableCollections, DisableCollections) [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Action to perform (For example: EnableCollections, DisableCollections)")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] @@ -42,13 +61,16 @@ public partial class SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkExpand Description = @"Action to perform (For example: EnableCollections, DisableCollections)", SerializedName = @"action", PossibleTypes = new [] { typeof(string) })] - public string Action { get => PayloadBody.Action ?? null; set => PayloadBody.Action = value; } + public string Action { get => _payloadBody.Action ?? null; set => _payloadBody.Action = value; } /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; @@ -62,17 +84,21 @@ public partial class SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkExpand Description = @"collection ids list that the action is performed on", SerializedName = @"collectionIds", PossibleTypes = new [] { typeof(string) })] - public string[] CollectionId { get => PayloadBody.CollectionId ?? null /* arrayOf */; set => PayloadBody.CollectionId = value; } + public string[] CollectionId { get => _payloadBody.CollectionId?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.CollectionId = (value != null ? new System.Collections.Generic.List(value) : null); } /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] [global::System.Management.Automation.ValidateNotNull] @@ -89,23 +115,17 @@ public partial class SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkExpand public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload _payloadBody= new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.BulkCollectionsPayload(); - - /// Bulk collections action properties - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload PayloadBody { get => this._payloadBody; set => this._payloadBody = value; } - /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Backing field for property. private string _privateStoreId; @@ -142,30 +162,35 @@ public partial class SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkExpand /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -177,7 +202,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// Handles/Dispatches events during the call to the REST service. @@ -224,8 +253,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -280,9 +334,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -295,12 +348,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.PrivateStoreBulkCollectionsAction(PrivateStoreId, PayloadBody, onOk, onDefault, this, Pipeline); + await this.Client.PrivateStoreBulkCollectionsAction(PrivateStoreId, _payloadBody, onOk, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,body=PayloadBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -313,7 +366,8 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet + /// class. /// public SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkExpanded() { @@ -331,12 +385,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -353,15 +407,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, body=PayloadBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, body=PayloadBody }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -371,12 +425,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -388,8 +442,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsResponse - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkViaJsonFilePath.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkViaJsonFilePath.cs new file mode 100644 index 000000000000..84b548413259 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkViaJsonFilePath.cs @@ -0,0 +1,458 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Perform an action on bulk collections + /// + /// [OpenAPI] BulkCollectionsAction=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/bulkCollectionsAction" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzMarketplaceBulkPrivateStoreCollectionAction_BulkViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Perform an action on bulk collections")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/bulkCollectionsAction", ApiVersion = "2023-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.NotSuggestDefaultParameterSet] + public partial class SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + public global::System.String _jsonString; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Bulk operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Bulk operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Bulk operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreBulkCollectionsAction' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreBulkCollectionsActionViaJsonString(PrivateStoreId, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the + /// cmdlet class. + /// + public SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkViaJsonFilePath() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkViaJsonString.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkViaJsonString.cs new file mode 100644 index 000000000000..1a899fb6eed6 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkViaJsonString.cs @@ -0,0 +1,456 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Perform an action on bulk collections + /// + /// [OpenAPI] BulkCollectionsAction=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/bulkCollectionsAction" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzMarketplaceBulkPrivateStoreCollectionAction_BulkViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Perform an action on bulk collections")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/bulkCollectionsAction", ApiVersion = "2023-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.NotSuggestDefaultParameterSet] + public partial class SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Bulk operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Bulk operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Bulk operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreBulkCollectionsAction' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreBulkCollectionsActionViaJsonString(PrivateStoreId, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public SetAzMarketplaceBulkPrivateStoreCollectionAction_BulkViaJsonString() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollectionOffer_UpdateExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollectionOffer_UpdateExpanded.cs index 097d65474219..b6af4d1b42ba 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollectionOffer_UpdateExpanded.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollectionOffer_UpdateExpanded.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Update or add an offer to a specific collection of the private store. @@ -13,11 +15,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzMarketplacePrivateStoreCollectionOffer_UpdateExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer))] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Update or add an offer to a specific collection of the private store.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}", ApiVersion = "2023-01-01")] public partial class SetAzMarketplacePrivateStoreCollectionOffer_UpdateExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,11 +37,29 @@ public partial class SetAzMarketplacePrivateStoreCollectionOffer_UpdateExpanded /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// The privateStore offer data structure. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Offer(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; @@ -56,9 +78,10 @@ public partial class SetAzMarketplacePrivateStoreCollectionOffer_UpdateExpanded public string CollectionId { get => this._collectionId; set => this._collectionId = value; } /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] @@ -73,7 +96,10 @@ public partial class SetAzMarketplacePrivateStoreCollectionOffer_UpdateExpanded Description = @"Identifier for purposes of race condition", SerializedName = @"eTag", PossibleTypes = new [] { typeof(string) })] - public string ETag { get => PayloadBody.ETag ?? null; set => PayloadBody.ETag = value; } + public string ETag { get => _payloadBody.ETag ?? null; set => _payloadBody.ETag = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] @@ -96,18 +122,18 @@ public partial class SetAzMarketplacePrivateStoreCollectionOffer_UpdateExpanded ReadOnly = false, Description = @"Icon File Uris", SerializedName = @"iconFileUris", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris) })] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOfferPropertiesIconFileUris IconFileUri { get => PayloadBody.IconFileUri ?? null /* object */; set => PayloadBody.IconFileUri = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris IconFileUri { get => _payloadBody.IconFileUri ?? null /* object */; set => _payloadBody.IconFileUri = value; } /// Accessor for our copy of the InvocationInfo. public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// Backing field for property. @@ -124,16 +150,10 @@ public partial class SetAzMarketplacePrivateStoreCollectionOffer_UpdateExpanded [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] public string OfferId { get => this._offerId; set => this._offerId = value; } - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer _payloadBody= new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Offer(); - - /// The privateStore offer data structure. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer PayloadBody { get => this._payloadBody; set => this._payloadBody = value; } - /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Offer plans [global::System.Management.Automation.AllowEmptyCollection] @@ -144,8 +164,8 @@ public partial class SetAzMarketplacePrivateStoreCollectionOffer_UpdateExpanded ReadOnly = false, Description = @"Offer plans", SerializedName = @"plans", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan) })] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan[] Plan { get => PayloadBody.Plan ?? null /* arrayOf */; set => PayloadBody.Plan = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[] Plan { get => _payloadBody.Plan?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.Plan = (value != null ? new System.Collections.Generic.List(value) : null); } /// Backing field for property. private string _privateStoreId; @@ -187,7 +207,7 @@ public partial class SetAzMarketplacePrivateStoreCollectionOffer_UpdateExpanded Description = @"Plan ids limitation for this offer", SerializedName = @"specificPlanIdsLimitation", PossibleTypes = new [] { typeof(string) })] - public string[] SpecificPlanIdLimitation { get => PayloadBody.SpecificPlanIdsLimitation ?? null /* arrayOf */; set => PayloadBody.SpecificPlanIdsLimitation = value; } + public string[] SpecificPlanIdLimitation { get => _payloadBody.SpecificPlanIdsLimitation?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SpecificPlanIdsLimitation = (value != null ? new System.Collections.Generic.List(value) : null); } /// /// Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed @@ -201,37 +221,42 @@ public partial class SetAzMarketplacePrivateStoreCollectionOffer_UpdateExpanded Description = @"Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated.", SerializedName = @"updateSuppressedDueIdempotence", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] - public global::System.Management.Automation.SwitchParameter UpdateSuppressedDueIdempotence { get => PayloadBody.UpdateSuppressedDueIdempotence ?? default(global::System.Management.Automation.SwitchParameter); set => PayloadBody.UpdateSuppressedDueIdempotence = value; } + public global::System.Management.Automation.SwitchParameter UpdateSuppressedDueIdempotence { get => _payloadBody.UpdateSuppressedDueIdempotence ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.UpdateSuppressedDueIdempotence = value; } /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -243,7 +268,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// Handles/Dispatches events during the call to the REST service. @@ -290,8 +319,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -346,9 +400,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -361,12 +414,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.PrivateStoreCollectionOfferCreateOrUpdate(PrivateStoreId, OfferId, CollectionId, PayloadBody, onOk, onDefault, this, Pipeline); + await this.Client.PrivateStoreCollectionOfferCreateOrUpdate(PrivateStoreId, CollectionId, OfferId, _payloadBody, onOk, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,OfferId=OfferId,CollectionId=CollectionId,body=PayloadBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId,OfferId=OfferId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -379,7 +432,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public SetAzMarketplacePrivateStoreCollectionOffer_UpdateExpanded() { @@ -397,12 +450,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -419,15 +472,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, OfferId=OfferId, CollectionId=CollectionId, body=PayloadBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, OfferId=OfferId, CollectionId=CollectionId, body=PayloadBody }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -437,12 +490,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -454,8 +507,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollectionOffer_UpdateViaJsonFilePath.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollectionOffer_UpdateViaJsonFilePath.cs new file mode 100644 index 000000000000..5b66fd879923 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollectionOffer_UpdateViaJsonFilePath.cs @@ -0,0 +1,486 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Update or add an offer to a specific collection of the private store. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzMarketplacePrivateStoreCollectionOffer_UpdateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Update or add an offer to a specific collection of the private store.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}", ApiVersion = "2023-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.NotSuggestDefaultParameterSet] + public partial class SetAzMarketplacePrivateStoreCollectionOffer_UpdateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + public global::System.String _jsonString; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Update operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCollectionOfferCreateOrUpdateViaJsonString(PrivateStoreId, CollectionId, OfferId, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId,OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public SetAzMarketplacePrivateStoreCollectionOffer_UpdateViaJsonFilePath() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollectionOffer_UpdateViaJsonString.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollectionOffer_UpdateViaJsonString.cs new file mode 100644 index 000000000000..168dd449aa45 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollectionOffer_UpdateViaJsonString.cs @@ -0,0 +1,484 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Update or add an offer to a specific collection of the private store. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzMarketplacePrivateStoreCollectionOffer_UpdateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Update or add an offer to a specific collection of the private store.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}", ApiVersion = "2023-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.NotSuggestDefaultParameterSet] + public partial class SetAzMarketplacePrivateStoreCollectionOffer_UpdateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Update operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCollectionOfferCreateOrUpdateViaJsonString(PrivateStoreId, CollectionId, OfferId, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId,OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public SetAzMarketplacePrivateStoreCollectionOffer_UpdateViaJsonString() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollection_UpdateExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollection_UpdateExpanded.cs index bcebaadc7f4d..9360ea89bba1 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollection_UpdateExpanded.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollection_UpdateExpanded.cs @@ -6,18 +6,22 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; - /// Create or update private store collection + /// Create private store collection /// /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" /// [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzMarketplacePrivateStoreCollection_UpdateExpanded", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection))] - [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Create or update private store collection")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Create private store collection")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}", ApiVersion = "2023-01-01")] public partial class SetAzMarketplacePrivateStoreCollection_UpdateExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,6 +37,21 @@ public partial class SetAzMarketplacePrivateStoreCollection_UpdateExpanded : glo /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// The Collection data structure. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Collection(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Indicating whether all subscriptions are selected (=true) or not (=false). [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicating whether all subscriptions are selected (=true) or not (=false).")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] @@ -42,13 +61,16 @@ public partial class SetAzMarketplacePrivateStoreCollection_UpdateExpanded : glo Description = @"Indicating whether all subscriptions are selected (=true) or not (=false).", SerializedName = @"allSubscriptions", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] - public global::System.Management.Automation.SwitchParameter AllSubscription { get => PayloadBody.AllSubscription ?? default(global::System.Management.Automation.SwitchParameter); set => PayloadBody.AllSubscription = value; } + public global::System.Management.Automation.SwitchParameter AllSubscription { get => _payloadBody.AllSubscription ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.AllSubscription = value; } /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// Gets or sets the association with Commercial's Billing Account. [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the association with Commercial's Billing Account.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] @@ -58,7 +80,7 @@ public partial class SetAzMarketplacePrivateStoreCollection_UpdateExpanded : glo Description = @"Gets or sets the association with Commercial's Billing Account.", SerializedName = @"claim", PossibleTypes = new [] { typeof(string) })] - public string Claim { get => PayloadBody.Claim ?? null; set => PayloadBody.Claim = value; } + public string Claim { get => _payloadBody.Claim ?? null; set => _payloadBody.Claim = value; } /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; @@ -86,12 +108,13 @@ public partial class SetAzMarketplacePrivateStoreCollection_UpdateExpanded : glo Description = @"Gets or sets collection name.", SerializedName = @"collectionName", PossibleTypes = new [] { typeof(string) })] - public string CollectionName { get => PayloadBody.CollectionName ?? null; set => PayloadBody.CollectionName = value; } + public string CollectionName { get => _payloadBody.CollectionName ?? null; set => _payloadBody.CollectionName = value; } /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] @@ -106,7 +129,10 @@ public partial class SetAzMarketplacePrivateStoreCollection_UpdateExpanded : glo Description = @"Indicating whether the collection is enabled or disabled.", SerializedName = @"enabled", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] - public global::System.Management.Automation.SwitchParameter Enabled { get => PayloadBody.Enabled ?? default(global::System.Management.Automation.SwitchParameter); set => PayloadBody.Enabled = value; } + public global::System.Management.Automation.SwitchParameter Enabled { get => _payloadBody.Enabled ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.Enabled = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] @@ -124,23 +150,17 @@ public partial class SetAzMarketplacePrivateStoreCollection_UpdateExpanded : glo public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection _payloadBody= new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.Collection(); - - /// The Collection data structure. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection PayloadBody { get => this._payloadBody; set => this._payloadBody = value; } - /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Backing field for property. private string _privateStoreId; @@ -185,37 +205,42 @@ public partial class SetAzMarketplacePrivateStoreCollection_UpdateExpanded : glo Description = @"Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request", SerializedName = @"subscriptionsList", PossibleTypes = new [] { typeof(string) })] - public string[] SubscriptionsList { get => PayloadBody.SubscriptionsList ?? null /* arrayOf */; set => PayloadBody.SubscriptionsList = value; } + public string[] SubscriptionsList { get => _payloadBody.SubscriptionsList?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SubscriptionsList = (value != null ? new System.Collections.Generic.List(value) : null); } /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens /// on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call /// /// Determines if the rest of the onOk method should be processed, or if the method should return /// immediately (set to true to skip further processing ) - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -227,7 +252,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// Handles/Dispatches events during the call to the REST service. @@ -274,8 +303,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -330,9 +384,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -345,12 +398,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.PrivateStoreCollectionCreateOrUpdate(PrivateStoreId, CollectionId, PayloadBody, onOk, onDefault, this, Pipeline); + await this.Client.PrivateStoreCollectionCreateOrUpdate(PrivateStoreId, CollectionId, _payloadBody, onOk, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId,body=PayloadBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -363,7 +416,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public SetAzMarketplacePrivateStoreCollection_UpdateExpanded() { @@ -381,12 +434,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -403,15 +456,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, CollectionId=CollectionId, body=PayloadBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId, CollectionId=CollectionId, body=PayloadBody }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); @@ -421,12 +474,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns 200 (OK). /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -438,8 +491,26 @@ protected override void StopProcessing() return ; } // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection - WriteObject((await response)); + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollection_UpdateViaJsonFilePath.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollection_UpdateViaJsonFilePath.cs new file mode 100644 index 000000000000..197a3430cb7e --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollection_UpdateViaJsonFilePath.cs @@ -0,0 +1,471 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Create private store collection + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzMarketplacePrivateStoreCollection_UpdateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Create private store collection")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}", ApiVersion = "2023-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.NotSuggestDefaultParameterSet] + public partial class SetAzMarketplacePrivateStoreCollection_UpdateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + public global::System.String _jsonString; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Update operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCollectionCreateOrUpdateViaJsonString(PrivateStoreId, CollectionId, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public SetAzMarketplacePrivateStoreCollection_UpdateViaJsonFilePath() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollection_UpdateViaJsonString.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollection_UpdateViaJsonString.cs new file mode 100644 index 000000000000..ec90c2197831 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStoreCollection_UpdateViaJsonString.cs @@ -0,0 +1,469 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Create private store collection + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzMarketplacePrivateStoreCollection_UpdateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Create private store collection")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}", ApiVersion = "2023-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.NotSuggestDefaultParameterSet] + public partial class SetAzMarketplacePrivateStoreCollection_UpdateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Update operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCollectionCreateOrUpdateViaJsonString(PrivateStoreId, CollectionId, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public SetAzMarketplacePrivateStoreCollection_UpdateViaJsonString() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStore_UpdateExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStore_UpdateExpanded.cs index 3e8f5d8eaf9e..386c2f4042cd 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStore_UpdateExpanded.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStore_UpdateExpanded.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets { using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; using System; /// Changes private store properties @@ -16,8 +18,10 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Changes private store properties")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}", ApiVersion = "2023-01-01")] public partial class SetAzMarketplacePrivateStore_UpdateExpanded : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext { /// A unique id generatd for the this cmdlet when it is instantiated. private string __correlationId = System.Guid.NewGuid().ToString(); @@ -33,6 +37,21 @@ public partial class SetAzMarketplacePrivateStore_UpdateExpanded : global::Syste /// private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// The PrivateStore data structure. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.PrivateStore(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + /// Indicates private store availability [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates private store availability")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] @@ -41,9 +60,9 @@ public partial class SetAzMarketplacePrivateStore_UpdateExpanded : global::Syste ReadOnly = false, Description = @"Indicates private store availability", SerializedName = @"availability", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability) })] - [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability))] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability Availability { get => PayloadBody.Availability ?? ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability)""); set => PayloadBody.Availability = value; } + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.PSArgumentCompleterAttribute("enabled", "disabled")] + public string Availability { get => _payloadBody.Availability ?? null; set => _payloadBody.Availability = value; } /// Gets or sets list of branding characteristics [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ExportAs(typeof(global::System.Collections.Hashtable))] @@ -54,21 +73,25 @@ public partial class SetAzMarketplacePrivateStore_UpdateExpanded : global::Syste ReadOnly = false, Description = @"Gets or sets list of branding characteristics", SerializedName = @"branding", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding) })] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStorePropertiesBranding Branding { get => PayloadBody.Branding ?? null /* object */; set => PayloadBody.Branding = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStorePropertiesBranding Branding { get => _payloadBody.Branding ?? null /* object */; set => _payloadBody.Branding = value; } /// Wait for .NET debugger to attach [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter Break { get; set; } + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + /// The reference to the client API class. public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; /// - /// The credentials, account, tenant, and subscription used for communication with Azure + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] [global::System.Management.Automation.ValidateNotNull] [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] @@ -83,7 +106,10 @@ public partial class SetAzMarketplacePrivateStore_UpdateExpanded : global::Syste Description = @"Identifier for purposes of race condition", SerializedName = @"eTag", PossibleTypes = new [] { typeof(string) })] - public string ETag { get => PayloadBody.ETag ?? null; set => PayloadBody.ETag = value; } + public string ETag { get => _payloadBody.ETag ?? null; set => _payloadBody.ETag = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } /// SendAsync Pipeline Steps to be appended to the front of the pipeline [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] @@ -124,14 +150,14 @@ public partial class SetAzMarketplacePrivateStore_UpdateExpanded : global::Syste Description = @"Is government", SerializedName = @"isGov", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] - public global::System.Management.Automation.SwitchParameter IsGov { get => PayloadBody.IsGov ?? default(global::System.Management.Automation.SwitchParameter); set => PayloadBody.IsGov = value; } + public global::System.Management.Automation.SwitchParameter IsGov { get => _payloadBody.IsGov ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.IsGov = value; } /// - /// cancellation delegate. Stops the cmdlet when called. + /// cancellation delegate. Stops the cmdlet when called. /// global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - /// cancellation token. + /// cancellation token. global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; /// Gets or sets list of notified recipients for new requests @@ -143,8 +169,8 @@ public partial class SetAzMarketplacePrivateStore_UpdateExpanded : global::Syste ReadOnly = false, Description = @"Gets or sets list of notified recipients for new requests", SerializedName = @"recipients", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient) })] - public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[] NotificationSettingRecipient { get => PayloadBody.NotificationSettingRecipient ?? null /* arrayOf */; set => PayloadBody.NotificationSettingRecipient = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient[] NotificationSettingRecipient { get => _payloadBody.NotificationSettingRecipient?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.NotificationSettingRecipient = (value != null ? new System.Collections.Generic.List(value) : null); } /// Gets or sets whether to send email to all marketplace admins for new requests [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets whether to send email to all marketplace admins for new requests")] @@ -155,7 +181,7 @@ public partial class SetAzMarketplacePrivateStore_UpdateExpanded : global::Syste Description = @"Gets or sets whether to send email to all marketplace admins for new requests", SerializedName = @"sendToAllMarketplaceAdmins", PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] - public global::System.Management.Automation.SwitchParameter NotificationSettingSendToAllMarketplaceAdmin { get => PayloadBody.NotificationSettingSendToAllMarketplaceAdmin ?? default(global::System.Management.Automation.SwitchParameter); set => PayloadBody.NotificationSettingSendToAllMarketplaceAdmin = value; } + public global::System.Management.Automation.SwitchParameter NotificationSettingSendToAllMarketplaceAdmin { get => _payloadBody.NotificationSettingSendToAllMarketplaceAdmin ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.NotificationSettingSendToAllMarketplaceAdmin = value; } /// /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. @@ -164,16 +190,10 @@ public partial class SetAzMarketplacePrivateStore_UpdateExpanded : global::Syste [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter PassThru { get; set; } - /// Backing field for property. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore _payloadBody= new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.PrivateStore(); - - /// The PrivateStore data structure. - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore PayloadBody { get => this._payloadBody; set => this._payloadBody = value; } - /// /// The instance of the that the remote call will use. /// - private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } /// Private Store Name [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Private Store Name")] @@ -184,7 +204,7 @@ public partial class SetAzMarketplacePrivateStore_UpdateExpanded : global::Syste Description = @"Private Store Name", SerializedName = @"privateStoreName", PossibleTypes = new [] { typeof(string) })] - public string PrivateStoreName { get => PayloadBody.PrivateStoreName ?? null; set => PayloadBody.PrivateStoreName = value; } + public string PrivateStoreName { get => _payloadBody.PrivateStoreName ?? null; set => _payloadBody.PrivateStoreName = value; } /// The URI for the proxy server to use [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] @@ -211,19 +231,19 @@ public partial class SetAzMarketplacePrivateStore_UpdateExpanded : global::Syste Description = @"Tenant id", SerializedName = @"tenantId", PossibleTypes = new [] { typeof(string) })] - public string TenantId { get => PayloadBody.TenantId ?? null; set => PayloadBody.TenantId = value; } + public string TenantId { get => _payloadBody.TenantId ?? null; set => _payloadBody.TenantId = value; } /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what /// happens on that response. Implement this method in a partial class to enable this behavior /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// Determines if the rest of the onDefault method should be processed, or if the method should /// return immediately (set to true to skip further processing ) - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); /// /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens @@ -240,6 +260,11 @@ public partial class SetAzMarketplacePrivateStore_UpdateExpanded : global::Syste /// protected override void BeginProcessing() { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); if (Break) { @@ -251,7 +276,11 @@ protected override void BeginProcessing() /// Performs clean-up after the command execution protected override void EndProcessing() { - ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } } /// Handles/Dispatches events during the call to the REST service. @@ -298,8 +327,33 @@ protected override void EndProcessing() WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } } - await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) { return ; @@ -354,9 +408,8 @@ protected override void ProcessRecord() { using( NoSynchronizationContext ) { - await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); if (null != HttpPipelinePrepend) { Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); @@ -369,12 +422,12 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.PrivateStoreCreateOrUpdate(Id, PayloadBody, onOk, onDefault, this, Pipeline); + await this.Client.PrivateStoreCreateOrUpdate(Id, _payloadBody, onOk, onDefault, this, Pipeline); await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Id=Id,body=PayloadBody}) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Id=Id}) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); @@ -387,7 +440,7 @@ protected override void ProcessRecord() } /// - /// Intializes a new instance of the cmdlet class. + /// Initializes a new instance of the cmdlet class. /// public SetAzMarketplacePrivateStore_UpdateExpanded() { @@ -405,12 +458,12 @@ protected override void StopProcessing() /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a from the remote call + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call /// /// A that will be complete when handling of the method is completed. /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) { using( NoSynchronizationContext ) { @@ -427,15 +480,15 @@ protected override void StopProcessing() if ((null == code || null == message)) { // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Id=Id, body=PayloadBody }) + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } }); } else { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Id=Id, body=PayloadBody }) + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } }); diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStore_UpdateViaJsonFilePath.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStore_UpdateViaJsonFilePath.cs new file mode 100644 index 000000000000..5b75fecd3941 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStore_UpdateViaJsonFilePath.cs @@ -0,0 +1,445 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Changes private store properties + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzMarketplacePrivateStore_UpdateViaJsonFilePath", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Changes private store properties")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}", ApiVersion = "2023-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.NotSuggestDefaultParameterSet] + public partial class SetAzMarketplacePrivateStore_UpdateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + public global::System.String _jsonString; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private string _id; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PrivateStoreId")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string Id { get => this._id; set => this._id = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonFilePath; + + /// Path of Json file supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Path of Json file supplied to the Update operation", + SerializedName = @"JsonFilePath", + PossibleTypes = new [] { typeof(string) })] + public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCreateOrUpdateViaJsonString(Id, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Id=Id}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public SetAzMarketplacePrivateStore_UpdateViaJsonFilePath() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStore_UpdateViaJsonString.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStore_UpdateViaJsonString.cs new file mode 100644 index 000000000000..09f0df8bbf39 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/SetAzMarketplacePrivateStore_UpdateViaJsonString.cs @@ -0,0 +1,443 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Changes private store properties + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzMarketplacePrivateStore_UpdateViaJsonString", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Changes private store properties")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}", ApiVersion = "2023-01-01")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.NotSuggestDefaultParameterSet] + public partial class SetAzMarketplacePrivateStore_UpdateViaJsonString : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private string _id; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PrivateStoreId")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string Id { get => this._id; set => this._id = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jsonString; + + /// Json string supplied to the Update operation + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Update operation")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Json string supplied to the Update operation", + SerializedName = @"JsonString", + PossibleTypes = new [] { typeof(string) })] + public string JsonString { get => this._jsonString; set => this._jsonString = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreCreateOrUpdateViaJsonString(Id, _jsonString, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Id=Id}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public SetAzMarketplacePrivateStore_UpdateViaJsonString() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/TestAzMarketplacePrivateStoreAnyExistingOffer_Any.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/TestAzMarketplacePrivateStoreAnyExistingOffer_Any.cs new file mode 100644 index 000000000000..befd7cf50e1b --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/TestAzMarketplacePrivateStoreAnyExistingOffer_Any.cs @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Query whether exists any offer in the collections. + /// + /// [OpenAPI] AnyExistingOffersInTheCollections=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/anyExistingOffersInTheCollections" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzMarketplacePrivateStoreAnyExistingOffer_Any", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Query whether exists any offer in the collections.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/anyExistingOffersInTheCollections", ApiVersion = "2023-01-01")] + public partial class TestAzMarketplacePrivateStoreAnyExistingOffer_Any : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreAnyExistingOffersInTheCollections' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PrivateStoreAnyExistingOffersInTheCollections(PrivateStoreId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzMarketplacePrivateStoreAnyExistingOffer_Any() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/TestAzMarketplacePrivateStoreAnyExistingOffer_AnyViaIdentity.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/TestAzMarketplacePrivateStoreAnyExistingOffer_AnyViaIdentity.cs new file mode 100644 index 000000000000..f9f76b5942af --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/TestAzMarketplacePrivateStoreAnyExistingOffer_AnyViaIdentity.cs @@ -0,0 +1,447 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Query whether exists any offer in the collections. + /// + /// [OpenAPI] AnyExistingOffersInTheCollections=>POST:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/anyExistingOffersInTheCollections" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzMarketplacePrivateStoreAnyExistingOffer_AnyViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Query whether exists any offer in the collections.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.HttpPath(Path = "/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/anyExistingOffersInTheCollections", ApiVersion = "2023-01-01")] + public partial class TestAzMarketplacePrivateStoreAnyExistingOffer_AnyViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreAnyExistingOffersInTheCollections' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PrivateStoreAnyExistingOffersInTheCollectionsViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PrivateStoreAnyExistingOffersInTheCollections(InputObject.PrivateStoreId ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public TestAzMarketplacePrivateStoreAnyExistingOffer_AnyViaIdentity() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateExpanded.cs new file mode 100644 index 000000000000..1e71caa1e135 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateExpanded.cs @@ -0,0 +1,560 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Update or add an offer to a specific collection of the private store. + /// + /// [OpenAPI] Get=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzMarketplacePrivateStoreCollectionOffer_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Update or add an offer to a specific collection of the private store.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + public partial class UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// The privateStore offer data structure. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Offer(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Identifier for purposes of race condition + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Identifier for purposes of race condition")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Identifier for purposes of race condition", + SerializedName = @"eTag", + PossibleTypes = new [] { typeof(string) })] + public string ETag { get => _payloadBody.ETag ?? null; set => _payloadBody.ETag = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Icon File Uris + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Icon File Uris")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Icon File Uris", + SerializedName = @"iconFileUris", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris IconFileUri { get => _payloadBody.IconFileUri ?? null /* object */; set => _payloadBody.IconFileUri = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Offer plans + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Offer plans")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Offer plans", + SerializedName = @"plans", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[] Plan { get => _payloadBody.Plan?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.Plan = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Plan ids limitation for this offer + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Plan ids limitation for this offer")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Plan ids limitation for this offer", + SerializedName = @"specificPlanIdsLimitation", + PossibleTypes = new [] { typeof(string) })] + public string[] SpecificPlanIdLimitation { get => _payloadBody.SpecificPlanIdsLimitation?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SpecificPlanIdsLimitation = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed + /// one in db, the offer would not be updated. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated.", + SerializedName = @"updateSuppressedDueIdempotence", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter UpdateSuppressedDueIdempotence { get => _payloadBody.UpdateSuppressedDueIdempotence ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.UpdateSuppressedDueIdempotence = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + _payloadBody = await this.Client.PrivateStoreCollectionOfferGetWithResult(PrivateStoreId, CollectionId, OfferId, this, Pipeline); + this.Update_payloadBody(); + await this.Client.PrivateStoreCollectionOfferCreateOrUpdate(PrivateStoreId, CollectionId, OfferId, _payloadBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId,OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateExpanded() + { + + } + + private void Update_payloadBody() + { + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("ETag"))) + { + this.ETag = (string)(this.MyInvocation?.BoundParameters["ETag"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("SpecificPlanIdLimitation"))) + { + this.SpecificPlanIdLimitation = (string[])(this.MyInvocation?.BoundParameters["SpecificPlanIdLimitation"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("UpdateSuppressedDueIdempotence"))) + { + this.UpdateSuppressedDueIdempotence = (global::System.Management.Automation.SwitchParameter)(this.MyInvocation?.BoundParameters["UpdateSuppressedDueIdempotence"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("IconFileUri"))) + { + this.IconFileUri = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris)(this.MyInvocation?.BoundParameters["IconFileUri"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Plan"))) + { + this.Plan = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[])(this.MyInvocation?.BoundParameters["Plan"]); + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityCollection.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityCollection.cs new file mode 100644 index 000000000000..fee65614b28b --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityCollection.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Update or add an offer to a specific collection of the private store. + /// + /// [OpenAPI] Get=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityCollection", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Update or add an offer to a specific collection of the private store.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + public partial class UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityCollection : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _collectionInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity CollectionInputObject { get => this._collectionInputObject; set => this._collectionInputObject = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer _payload; + + /// The privateStore offer data structure. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The privateStore offer data structure.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The privateStore offer data structure.", + SerializedName = @"payload", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer Payload { get => this._payload; set => this._payload = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (CollectionInputObject?.Id != null) + { + this.CollectionInputObject.Id += $"/offers/{(global::System.Uri.EscapeDataString(this.OfferId.ToString()))}"; + Payload = await this.Client.PrivateStoreCollectionOfferGetViaIdentityWithResult(CollectionInputObject.Id, this, Pipeline); + this.UpdatePayload(); + await this.Client.PrivateStoreCollectionOfferCreateOrUpdateViaIdentity(CollectionInputObject.Id, Payload, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == CollectionInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("CollectionInputObject has null value for CollectionInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, CollectionInputObject) ); + } + if (null == CollectionInputObject.CollectionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("CollectionInputObject has null value for CollectionInputObject.CollectionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, CollectionInputObject) ); + } + Payload = await this.Client.PrivateStoreCollectionOfferGetWithResult(CollectionInputObject.PrivateStoreId ?? null, CollectionInputObject.CollectionId ?? null, OfferId, this, Pipeline); + this.UpdatePayload(); + await this.Client.PrivateStoreCollectionOfferCreateOrUpdate(CollectionInputObject.PrivateStoreId ?? null, CollectionInputObject.CollectionId ?? null, OfferId, Payload, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityCollection() + { + + } + + private void UpdatePayload() + { + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Payload"))) + { + this.Payload = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer)(this.MyInvocation?.BoundParameters["Payload"]); + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityCollectionExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityCollectionExpanded.cs new file mode 100644 index 000000000000..ac06f9b1cd0e --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityCollectionExpanded.cs @@ -0,0 +1,559 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Update or add an offer to a specific collection of the private store. + /// + /// [OpenAPI] Get=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityCollectionExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Update or add an offer to a specific collection of the private store.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + public partial class UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityCollectionExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// The privateStore offer data structure. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Offer(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _collectionInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity CollectionInputObject { get => this._collectionInputObject; set => this._collectionInputObject = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Identifier for purposes of race condition + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Identifier for purposes of race condition")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Identifier for purposes of race condition", + SerializedName = @"eTag", + PossibleTypes = new [] { typeof(string) })] + public string ETag { get => _payloadBody.ETag ?? null; set => _payloadBody.ETag = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Icon File Uris + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Icon File Uris")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Icon File Uris", + SerializedName = @"iconFileUris", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris IconFileUri { get => _payloadBody.IconFileUri ?? null /* object */; set => _payloadBody.IconFileUri = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Offer plans + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Offer plans")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Offer plans", + SerializedName = @"plans", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[] Plan { get => _payloadBody.Plan?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.Plan = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Plan ids limitation for this offer + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Plan ids limitation for this offer")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Plan ids limitation for this offer", + SerializedName = @"specificPlanIdsLimitation", + PossibleTypes = new [] { typeof(string) })] + public string[] SpecificPlanIdLimitation { get => _payloadBody.SpecificPlanIdsLimitation?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SpecificPlanIdsLimitation = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed + /// one in db, the offer would not be updated. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated.", + SerializedName = @"updateSuppressedDueIdempotence", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter UpdateSuppressedDueIdempotence { get => _payloadBody.UpdateSuppressedDueIdempotence ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.UpdateSuppressedDueIdempotence = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (CollectionInputObject?.Id != null) + { + this.CollectionInputObject.Id += $"/offers/{(global::System.Uri.EscapeDataString(this.OfferId.ToString()))}"; + _payloadBody = await this.Client.PrivateStoreCollectionOfferGetViaIdentityWithResult(CollectionInputObject.Id, this, Pipeline); + this.Update_payloadBody(); + await this.Client.PrivateStoreCollectionOfferCreateOrUpdateViaIdentity(CollectionInputObject.Id, _payloadBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == CollectionInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("CollectionInputObject has null value for CollectionInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, CollectionInputObject) ); + } + if (null == CollectionInputObject.CollectionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("CollectionInputObject has null value for CollectionInputObject.CollectionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, CollectionInputObject) ); + } + _payloadBody = await this.Client.PrivateStoreCollectionOfferGetWithResult(CollectionInputObject.PrivateStoreId ?? null, CollectionInputObject.CollectionId ?? null, OfferId, this, Pipeline); + this.Update_payloadBody(); + await this.Client.PrivateStoreCollectionOfferCreateOrUpdate(CollectionInputObject.PrivateStoreId ?? null, CollectionInputObject.CollectionId ?? null, OfferId, _payloadBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityCollectionExpanded() + { + + } + + private void Update_payloadBody() + { + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("ETag"))) + { + this.ETag = (string)(this.MyInvocation?.BoundParameters["ETag"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("SpecificPlanIdLimitation"))) + { + this.SpecificPlanIdLimitation = (string[])(this.MyInvocation?.BoundParameters["SpecificPlanIdLimitation"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("UpdateSuppressedDueIdempotence"))) + { + this.UpdateSuppressedDueIdempotence = (global::System.Management.Automation.SwitchParameter)(this.MyInvocation?.BoundParameters["UpdateSuppressedDueIdempotence"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("IconFileUri"))) + { + this.IconFileUri = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris)(this.MyInvocation?.BoundParameters["IconFileUri"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Plan"))) + { + this.Plan = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[])(this.MyInvocation?.BoundParameters["Plan"]); + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..496ebd9706ef --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityExpanded.cs @@ -0,0 +1,548 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Update or add an offer to a specific collection of the private store. + /// + /// [OpenAPI] Get=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Update or add an offer to a specific collection of the private store.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + public partial class UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// The privateStore offer data structure. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Offer(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Identifier for purposes of race condition + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Identifier for purposes of race condition")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Identifier for purposes of race condition", + SerializedName = @"eTag", + PossibleTypes = new [] { typeof(string) })] + public string ETag { get => _payloadBody.ETag ?? null; set => _payloadBody.ETag = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Icon File Uris + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Icon File Uris")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Icon File Uris", + SerializedName = @"iconFileUris", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris IconFileUri { get => _payloadBody.IconFileUri ?? null /* object */; set => _payloadBody.IconFileUri = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Offer plans + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Offer plans")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Offer plans", + SerializedName = @"plans", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[] Plan { get => _payloadBody.Plan?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.Plan = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Plan ids limitation for this offer + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Plan ids limitation for this offer")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Plan ids limitation for this offer", + SerializedName = @"specificPlanIdsLimitation", + PossibleTypes = new [] { typeof(string) })] + public string[] SpecificPlanIdLimitation { get => _payloadBody.SpecificPlanIdsLimitation?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SpecificPlanIdsLimitation = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed + /// one in db, the offer would not be updated. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated.", + SerializedName = @"updateSuppressedDueIdempotence", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter UpdateSuppressedDueIdempotence { get => _payloadBody.UpdateSuppressedDueIdempotence ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.UpdateSuppressedDueIdempotence = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + _payloadBody = await this.Client.PrivateStoreCollectionOfferGetViaIdentityWithResult(InputObject.Id, this, Pipeline); + this.Update_payloadBody(); + await this.Client.PrivateStoreCollectionOfferCreateOrUpdateViaIdentity(InputObject.Id, _payloadBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.CollectionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.CollectionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.OfferId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.OfferId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + _payloadBody = await this.Client.PrivateStoreCollectionOfferGetWithResult(InputObject.PrivateStoreId ?? null, InputObject.CollectionId ?? null, InputObject.OfferId ?? null, this, Pipeline); + this.Update_payloadBody(); + await this.Client.PrivateStoreCollectionOfferCreateOrUpdate(InputObject.PrivateStoreId ?? null, InputObject.CollectionId ?? null, InputObject.OfferId ?? null, _payloadBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityExpanded() + { + + } + + private void Update_payloadBody() + { + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("ETag"))) + { + this.ETag = (string)(this.MyInvocation?.BoundParameters["ETag"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("SpecificPlanIdLimitation"))) + { + this.SpecificPlanIdLimitation = (string[])(this.MyInvocation?.BoundParameters["SpecificPlanIdLimitation"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("UpdateSuppressedDueIdempotence"))) + { + this.UpdateSuppressedDueIdempotence = (global::System.Management.Automation.SwitchParameter)(this.MyInvocation?.BoundParameters["UpdateSuppressedDueIdempotence"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("IconFileUri"))) + { + this.IconFileUri = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris)(this.MyInvocation?.BoundParameters["IconFileUri"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Plan"))) + { + this.Plan = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[])(this.MyInvocation?.BoundParameters["Plan"]); + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityPrivateStore.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityPrivateStore.cs new file mode 100644 index 000000000000..0232d1d2d7be --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityPrivateStore.cs @@ -0,0 +1,503 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Update or add an offer to a specific collection of the private store. + /// + /// [OpenAPI] Get=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityPrivateStore", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Update or add an offer to a specific collection of the private store.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + public partial class UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityPrivateStore : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer _payload; + + /// The privateStore offer data structure. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The privateStore offer data structure.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The privateStore offer data structure.", + SerializedName = @"payload", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer Payload { get => this._payload; set => this._payload = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _privateStoreInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity PrivateStoreInputObject { get => this._privateStoreInputObject; set => this._privateStoreInputObject = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (PrivateStoreInputObject?.Id != null) + { + this.PrivateStoreInputObject.Id += $"/collections/{(global::System.Uri.EscapeDataString(this.CollectionId.ToString()))}/offers/{(global::System.Uri.EscapeDataString(this.OfferId.ToString()))}"; + Payload = await this.Client.PrivateStoreCollectionOfferGetViaIdentityWithResult(PrivateStoreInputObject.Id, this, Pipeline); + this.UpdatePayload(); + await this.Client.PrivateStoreCollectionOfferCreateOrUpdateViaIdentity(PrivateStoreInputObject.Id, Payload, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == PrivateStoreInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("PrivateStoreInputObject has null value for PrivateStoreInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, PrivateStoreInputObject) ); + } + Payload = await this.Client.PrivateStoreCollectionOfferGetWithResult(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, OfferId, this, Pipeline); + this.UpdatePayload(); + await this.Client.PrivateStoreCollectionOfferCreateOrUpdate(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, OfferId, Payload, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { CollectionId=CollectionId,OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityPrivateStore() + { + + } + + private void UpdatePayload() + { + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Payload"))) + { + this.Payload = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer)(this.MyInvocation?.BoundParameters["Payload"]); + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityPrivateStoreExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityPrivateStoreExpanded.cs new file mode 100644 index 000000000000..092c50b95e9b --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityPrivateStoreExpanded.cs @@ -0,0 +1,569 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Update or add an offer to a specific collection of the private store. + /// + /// [OpenAPI] Get=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityPrivateStoreExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Update or add an offer to a specific collection of the private store.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + public partial class UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityPrivateStoreExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// The privateStore offer data structure. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Offer(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Identifier for purposes of race condition + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Identifier for purposes of race condition")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Identifier for purposes of race condition", + SerializedName = @"eTag", + PossibleTypes = new [] { typeof(string) })] + public string ETag { get => _payloadBody.ETag ?? null; set => _payloadBody.ETag = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Icon File Uris + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Icon File Uris")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Icon File Uris", + SerializedName = @"iconFileUris", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris IconFileUri { get => _payloadBody.IconFileUri ?? null /* object */; set => _payloadBody.IconFileUri = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _offerId; + + /// The offer ID to update or delete + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The offer ID to update or delete")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The offer ID to update or delete", + SerializedName = @"offerId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string OfferId { get => this._offerId; set => this._offerId = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Offer plans + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Offer plans")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Offer plans", + SerializedName = @"plans", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan) })] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[] Plan { get => _payloadBody.Plan?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.Plan = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _privateStoreInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity PrivateStoreInputObject { get => this._privateStoreInputObject; set => this._privateStoreInputObject = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Plan ids limitation for this offer + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Plan ids limitation for this offer")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Plan ids limitation for this offer", + SerializedName = @"specificPlanIdsLimitation", + PossibleTypes = new [] { typeof(string) })] + public string[] SpecificPlanIdLimitation { get => _payloadBody.SpecificPlanIdsLimitation?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SpecificPlanIdsLimitation = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed + /// one in db, the offer would not be updated. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated.", + SerializedName = @"updateSuppressedDueIdempotence", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter UpdateSuppressedDueIdempotence { get => _payloadBody.UpdateSuppressedDueIdempotence ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.UpdateSuppressedDueIdempotence = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionOfferCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (PrivateStoreInputObject?.Id != null) + { + this.PrivateStoreInputObject.Id += $"/collections/{(global::System.Uri.EscapeDataString(this.CollectionId.ToString()))}/offers/{(global::System.Uri.EscapeDataString(this.OfferId.ToString()))}"; + _payloadBody = await this.Client.PrivateStoreCollectionOfferGetViaIdentityWithResult(PrivateStoreInputObject.Id, this, Pipeline); + this.Update_payloadBody(); + await this.Client.PrivateStoreCollectionOfferCreateOrUpdateViaIdentity(PrivateStoreInputObject.Id, _payloadBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == PrivateStoreInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("PrivateStoreInputObject has null value for PrivateStoreInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, PrivateStoreInputObject) ); + } + _payloadBody = await this.Client.PrivateStoreCollectionOfferGetWithResult(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, OfferId, this, Pipeline); + this.Update_payloadBody(); + await this.Client.PrivateStoreCollectionOfferCreateOrUpdate(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, OfferId, _payloadBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { CollectionId=CollectionId,OfferId=OfferId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzMarketplacePrivateStoreCollectionOffer_UpdateViaIdentityPrivateStoreExpanded() + { + + } + + private void Update_payloadBody() + { + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("ETag"))) + { + this.ETag = (string)(this.MyInvocation?.BoundParameters["ETag"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("SpecificPlanIdLimitation"))) + { + this.SpecificPlanIdLimitation = (string[])(this.MyInvocation?.BoundParameters["SpecificPlanIdLimitation"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("UpdateSuppressedDueIdempotence"))) + { + this.UpdateSuppressedDueIdempotence = (global::System.Management.Automation.SwitchParameter)(this.MyInvocation?.BoundParameters["UpdateSuppressedDueIdempotence"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("IconFileUri"))) + { + this.IconFileUri = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOfferPropertiesIconFileUris)(this.MyInvocation?.BoundParameters["IconFileUri"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Plan"))) + { + this.Plan = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[])(this.MyInvocation?.BoundParameters["Plan"]); + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollection_UpdateExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollection_UpdateExpanded.cs new file mode 100644 index 000000000000..b7183e9baff2 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollection_UpdateExpanded.cs @@ -0,0 +1,543 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Create private store collection + /// + /// [OpenAPI] Get=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzMarketplacePrivateStoreCollection_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Create private store collection")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + public partial class UpdateAzMarketplacePrivateStoreCollection_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// The Collection data structure. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Collection(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Indicating whether all subscriptions are selected (=true) or not (=false). + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicating whether all subscriptions are selected (=true) or not (=false).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicating whether all subscriptions are selected (=true) or not (=false).", + SerializedName = @"allSubscriptions", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter AllSubscription { get => _payloadBody.AllSubscription ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.AllSubscription = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// Gets or sets the association with Commercial's Billing Account. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the association with Commercial's Billing Account.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the association with Commercial's Billing Account.", + SerializedName = @"claim", + PossibleTypes = new [] { typeof(string) })] + public string Claim { get => _payloadBody.Claim ?? null; set => _payloadBody.Claim = value; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// Gets or sets collection name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets collection name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets collection name.", + SerializedName = @"collectionName", + PossibleTypes = new [] { typeof(string) })] + public string CollectionName { get => _payloadBody.CollectionName ?? null; set => _payloadBody.CollectionName = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Indicating whether the collection is enabled or disabled. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicating whether the collection is enabled or disabled.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicating whether the collection is enabled or disabled.", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter Enabled { get => _payloadBody.Enabled ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.Enabled = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _privateStoreId; + + /// The store ID - must use the tenant ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The store ID - must use the tenant ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The store ID - must use the tenant ID", + SerializedName = @"privateStoreId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string PrivateStoreId { get => this._privateStoreId; set => this._privateStoreId = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, + /// explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request", + SerializedName = @"subscriptionsList", + PossibleTypes = new [] { typeof(string) })] + public string[] SubscriptionsList { get => _payloadBody.SubscriptionsList?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SubscriptionsList = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + _payloadBody = await this.Client.PrivateStoreCollectionGetWithResult(PrivateStoreId, CollectionId, this, Pipeline); + this.Update_payloadBody(); + await this.Client.PrivateStoreCollectionCreateOrUpdate(PrivateStoreId, CollectionId, _payloadBody, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { PrivateStoreId=PrivateStoreId,CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzMarketplacePrivateStoreCollection_UpdateExpanded() + { + + } + + private void Update_payloadBody() + { + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("CollectionName"))) + { + this.CollectionName = (string)(this.MyInvocation?.BoundParameters["CollectionName"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Claim"))) + { + this.Claim = (string)(this.MyInvocation?.BoundParameters["Claim"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("AllSubscription"))) + { + this.AllSubscription = (global::System.Management.Automation.SwitchParameter)(this.MyInvocation?.BoundParameters["AllSubscription"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("SubscriptionsList"))) + { + this.SubscriptionsList = (string[])(this.MyInvocation?.BoundParameters["SubscriptionsList"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Enabled"))) + { + this.Enabled = (global::System.Management.Automation.SwitchParameter)(this.MyInvocation?.BoundParameters["Enabled"]); + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollection_UpdateViaIdentityExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollection_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..4257adfee99b --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollection_UpdateViaIdentityExpanded.cs @@ -0,0 +1,542 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Create private store collection + /// + /// [OpenAPI] Get=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzMarketplacePrivateStoreCollection_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Create private store collection")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + public partial class UpdateAzMarketplacePrivateStoreCollection_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// The Collection data structure. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Collection(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Indicating whether all subscriptions are selected (=true) or not (=false). + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicating whether all subscriptions are selected (=true) or not (=false).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicating whether all subscriptions are selected (=true) or not (=false).", + SerializedName = @"allSubscriptions", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter AllSubscription { get => _payloadBody.AllSubscription ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.AllSubscription = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// Gets or sets the association with Commercial's Billing Account. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the association with Commercial's Billing Account.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the association with Commercial's Billing Account.", + SerializedName = @"claim", + PossibleTypes = new [] { typeof(string) })] + public string Claim { get => _payloadBody.Claim ?? null; set => _payloadBody.Claim = value; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Gets or sets collection name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets collection name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets collection name.", + SerializedName = @"collectionName", + PossibleTypes = new [] { typeof(string) })] + public string CollectionName { get => _payloadBody.CollectionName ?? null; set => _payloadBody.CollectionName = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Indicating whether the collection is enabled or disabled. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicating whether the collection is enabled or disabled.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicating whether the collection is enabled or disabled.", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter Enabled { get => _payloadBody.Enabled ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.Enabled = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, + /// explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request", + SerializedName = @"subscriptionsList", + PossibleTypes = new [] { typeof(string) })] + public string[] SubscriptionsList { get => _payloadBody.SubscriptionsList?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SubscriptionsList = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + _payloadBody = await this.Client.PrivateStoreCollectionGetViaIdentityWithResult(InputObject.Id, this, Pipeline); + this.Update_payloadBody(); + await this.Client.PrivateStoreCollectionCreateOrUpdateViaIdentity(InputObject.Id, _payloadBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.CollectionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.CollectionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + _payloadBody = await this.Client.PrivateStoreCollectionGetWithResult(InputObject.PrivateStoreId ?? null, InputObject.CollectionId ?? null, this, Pipeline); + this.Update_payloadBody(); + await this.Client.PrivateStoreCollectionCreateOrUpdate(InputObject.PrivateStoreId ?? null, InputObject.CollectionId ?? null, _payloadBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet + /// class. + /// + public UpdateAzMarketplacePrivateStoreCollection_UpdateViaIdentityExpanded() + { + + } + + private void Update_payloadBody() + { + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("CollectionName"))) + { + this.CollectionName = (string)(this.MyInvocation?.BoundParameters["CollectionName"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Claim"))) + { + this.Claim = (string)(this.MyInvocation?.BoundParameters["Claim"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("AllSubscription"))) + { + this.AllSubscription = (global::System.Management.Automation.SwitchParameter)(this.MyInvocation?.BoundParameters["AllSubscription"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("SubscriptionsList"))) + { + this.SubscriptionsList = (string[])(this.MyInvocation?.BoundParameters["SubscriptionsList"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Enabled"))) + { + this.Enabled = (global::System.Management.Automation.SwitchParameter)(this.MyInvocation?.BoundParameters["Enabled"]); + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollection_UpdateViaIdentityPrivateStore.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollection_UpdateViaIdentityPrivateStore.cs new file mode 100644 index 000000000000..706f2863140a --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollection_UpdateViaIdentityPrivateStore.cs @@ -0,0 +1,489 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Create private store collection + /// + /// [OpenAPI] Get=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzMarketplacePrivateStoreCollection_UpdateViaIdentityPrivateStore", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Create private store collection")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + public partial class UpdateAzMarketplacePrivateStoreCollection_UpdateViaIdentityPrivateStore : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection _payload; + + /// The Collection data structure. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The Collection data structure.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The Collection data structure.", + SerializedName = @"payload", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection Payload { get => this._payload; set => this._payload = value; } + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _privateStoreInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity PrivateStoreInputObject { get => this._privateStoreInputObject; set => this._privateStoreInputObject = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (PrivateStoreInputObject?.Id != null) + { + this.PrivateStoreInputObject.Id += $"/collections/{(global::System.Uri.EscapeDataString(this.CollectionId.ToString()))}"; + Payload = await this.Client.PrivateStoreCollectionGetViaIdentityWithResult(PrivateStoreInputObject.Id, this, Pipeline); + this.UpdatePayload(); + await this.Client.PrivateStoreCollectionCreateOrUpdateViaIdentity(PrivateStoreInputObject.Id, Payload, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == PrivateStoreInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("PrivateStoreInputObject has null value for PrivateStoreInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, PrivateStoreInputObject) ); + } + Payload = await this.Client.PrivateStoreCollectionGetWithResult(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, this, Pipeline); + this.UpdatePayload(); + await this.Client.PrivateStoreCollectionCreateOrUpdate(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, Payload, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzMarketplacePrivateStoreCollection_UpdateViaIdentityPrivateStore() + { + + } + + private void UpdatePayload() + { + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Payload"))) + { + this.Payload = (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection)(this.MyInvocation?.BoundParameters["Payload"]); + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollection_UpdateViaIdentityPrivateStoreExpanded.cs b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollection_UpdateViaIdentityPrivateStoreExpanded.cs new file mode 100644 index 000000000000..293c553a1019 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/cmdlets/UpdateAzMarketplacePrivateStoreCollection_UpdateViaIdentityPrivateStoreExpanded.cs @@ -0,0 +1,553 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell; + using Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets; + using System; + + /// Create private store collection + /// + /// [OpenAPI] Get=>GET:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" + /// [OpenAPI] CreateOrUpdate=>PUT:"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzMarketplacePrivateStoreCollection_UpdateViaIdentityPrivateStoreExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Description(@"Create private store collection")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Generated] + public partial class UpdateAzMarketplacePrivateStoreCollection_UpdateViaIdentityPrivateStoreExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener, + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// A dictionary to carry over additional data for pipeline. + private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); + + /// A buffer to record first returned object in response. + private object _firstResponse = null; + + /// The Collection data structure. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection _payloadBody = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Collection(); + + /// + /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. + /// Two means multiple returned objects in response. + /// + private int _responseSize = 0; + + /// Indicating whether all subscriptions are selected (=true) or not (=false). + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicating whether all subscriptions are selected (=true) or not (=false).")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicating whether all subscriptions are selected (=true) or not (=false).", + SerializedName = @"allSubscriptions", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter AllSubscription { get => _payloadBody.AllSubscription ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.AllSubscription = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Accessor for cancellationTokenSource. + public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } + + /// Gets or sets the association with Commercial's Billing Account. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the association with Commercial's Billing Account.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the association with Commercial's Billing Account.", + SerializedName = @"claim", + PossibleTypes = new [] { typeof(string) })] + public string Claim { get => _payloadBody.Claim ?? null; set => _payloadBody.Claim = value; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _collectionId; + + /// The collection ID + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The collection ID")] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The collection ID", + SerializedName = @"collectionId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public string CollectionId { get => this._collectionId; set => this._collectionId = value; } + + /// Gets or sets collection name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets collection name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets collection name.", + SerializedName = @"collectionName", + PossibleTypes = new [] { typeof(string) })] + public string CollectionName { get => _payloadBody.CollectionName ?? null; set => _payloadBody.CollectionName = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Indicating whether the collection is enabled or disabled. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicating whether the collection is enabled or disabled.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicating whether the collection is enabled or disabled.", + SerializedName = @"enabled", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter Enabled { get => _payloadBody.Enabled ?? default(global::System.Management.Automation.SwitchParameter); set => _payloadBody.Enabled = value; } + + /// Accessor for extensibleParameters. + public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity _privateStoreInputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity PrivateStoreInputObject { get => this._privateStoreInputObject; set => this._privateStoreInputObject = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, + /// explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Marketplace.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request", + SerializedName = @"subscriptionsList", + PossibleTypes = new [] { typeof(string) })] + public string[] SubscriptionsList { get => _payloadBody.SubscriptionsList?.ToArray() ?? null /* fixedArrayOf */; set => _payloadBody.SubscriptionsList = (value != null ? new System.Collections.Generic.List(value) : null); } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse); + } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.Progress: + { + var data = messageData(); + int progress = (int)data.Value; + string activityMessage, statusDescription; + global::System.Management.Automation.ProgressRecordType recordType; + if (progress < 100) + { + activityMessage = "In progress"; + statusDescription = "Checking operation status"; + recordType = System.Management.Automation.ProgressRecordType.Processing; + } + else + { + activityMessage = "Completed"; + statusDescription = "Completed"; + recordType = System.Management.Automation.ProgressRecordType.Completed; + } + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) + { + PercentComplete = progress, + RecordType = recordType + }); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PrivateStoreCollectionCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (PrivateStoreInputObject?.Id != null) + { + this.PrivateStoreInputObject.Id += $"/collections/{(global::System.Uri.EscapeDataString(this.CollectionId.ToString()))}"; + _payloadBody = await this.Client.PrivateStoreCollectionGetViaIdentityWithResult(PrivateStoreInputObject.Id, this, Pipeline); + this.Update_payloadBody(); + await this.Client.PrivateStoreCollectionCreateOrUpdateViaIdentity(PrivateStoreInputObject.Id, _payloadBody, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == PrivateStoreInputObject.PrivateStoreId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("PrivateStoreInputObject has null value for PrivateStoreInputObject.PrivateStoreId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, PrivateStoreInputObject) ); + } + _payloadBody = await this.Client.PrivateStoreCollectionGetWithResult(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, this, Pipeline); + this.Update_payloadBody(); + await this.Client.PrivateStoreCollectionCreateOrUpdate(PrivateStoreInputObject.PrivateStoreId ?? null, CollectionId, _payloadBody, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { CollectionId=CollectionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Initializes a new instance of the cmdlet class. + /// + public UpdateAzMarketplacePrivateStoreCollection_UpdateViaIdentityPrivateStoreExpanded() + { + + } + + private void Update_payloadBody() + { + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("CollectionName"))) + { + this.CollectionName = (string)(this.MyInvocation?.BoundParameters["CollectionName"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Claim"))) + { + this.Claim = (string)(this.MyInvocation?.BoundParameters["Claim"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("AllSubscription"))) + { + this.AllSubscription = (global::System.Management.Automation.SwitchParameter)(this.MyInvocation?.BoundParameters["AllSubscription"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("SubscriptionsList"))) + { + this.SubscriptionsList = (string[])(this.MyInvocation?.BoundParameters["SubscriptionsList"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Enabled"))) + { + this.Enabled = (global::System.Management.Automation.SwitchParameter)(this.MyInvocation?.BoundParameters["Enabled"]); + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + var result = (await response); + if (null != result) + { + if (0 == _responseSize) + { + _firstResponse = result; + _responseSize = 1; + } + else + { + if (1 ==_responseSize) + { + // Flush buffer + WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); + } + WriteObject(result.AddMultipleTypeNameIntoPSObject()); + _responseSize = 2; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/AsyncOperationResponse.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/AsyncOperationResponse.cs index af039188b7cb..fd9f82a96b5b 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/AsyncOperationResponse.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/AsyncOperationResponse.cs @@ -31,10 +31,10 @@ public static AsyncOperationResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets /// - /// Creates a new instance of , deserializing the content from a json string. + /// Creates a new instance of , deserializing the content from a json string. /// /// a string containing a JSON serialized instance of this model. - /// an instance of the model class. + /// an instance of the model class. public static AsyncOperationResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Json.JsonNode.Parse(jsonText)); } @@ -43,19 +43,19 @@ public partial class AsyncOperationResponseTypeConverter : System.Management.Aut { /// - /// Determines if the converter can convert the parameter to the + /// Determines if the converter can convert the parameter to the /// parameter. /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the + /// true if the converter can convert the parameter to the /// parameter, otherwise false. /// public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); /// - /// Determines if the converter can convert the parameter to the + /// Determines if the converter can convert the parameter to a type /// parameter. /// /// the instance to check if it can be converted to the - /// Determines if the parameter can be converted to the parameter + /// Determines if the parameter can be converted to the parameter /// /// the to convert from /// the to convert to /// - /// true if the converter can convert the parameter to the + /// true if the converter can convert the parameter to the /// parameter, otherwise false /// public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; /// - /// Converts the parameter to the parameter using and + /// Converts the parameter to the parameter using and /// /// the to convert from /// the to convert to @@ -128,8 +128,7 @@ public static bool CanConvertFrom(dynamic sourceValue) public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); /// - /// Converts the parameter to the parameter using and + /// Converts the parameter into an instance of /// /// the value to convert into an instance of . /// diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs new file mode 100644 index 000000000000..3e4b17d7f28f --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/Attributes/ExternalDocsAttribute.cs @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace +{ + using System; + using System.Collections.Generic; + using System.Text; + + [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)] + public class ExternalDocsAttribute : Attribute + { + + public string Description { get; } + + public string Url { get; } + + public ExternalDocsAttribute(string url) + { + Url = url; + } + + public ExternalDocsAttribute(string url, string description) + { + Url = url; + Description = description; + } + } +} diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs new file mode 100644 index 000000000000..8405db1ed8f0 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/Attributes/PSArgumentCompleterAttribute.cs @@ -0,0 +1,52 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace +{ + public class PSArgumentCompleterAttribute : ArgumentCompleterAttribute + { + internal string[] ResourceTypes; + + public PSArgumentCompleterAttribute(params string[] argumentList) : base(CreateScriptBlock(argumentList)) + { + ResourceTypes = argumentList; + } + + public static ScriptBlock CreateScriptBlock(string[] resourceTypes) + { + List outputResourceTypes = new List(); + foreach (string resourceType in resourceTypes) + { + if (resourceType.Contains(" ")) + { + outputResourceTypes.Add("\'\'" + resourceType + "\'\'"); + } + else + { + outputResourceTypes.Add(resourceType); + } + } + string scriptResourceTypeList = "'" + String.Join("' , '", outputResourceTypes) + "'"; + string script = "param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)\n" + + String.Format("$values = {0}\n", scriptResourceTypeList) + + "$values | Where-Object { $_ -Like \"$wordToComplete*\" -or $_ -Like \"'$wordToComplete*\" } | Sort-Object | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) }"; + ScriptBlock scriptBlock = ScriptBlock.Create(script); + return scriptBlock; + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs index e864bed44290..99d2f66aaa7b 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs @@ -20,11 +20,13 @@ public class ExportFormatPs1xml : PSCmdlet public string FilePath { get; set; } private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models"; - private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support"; + private const string SupportNamespace = @"${$project.supportNamespace.fullName}"; private const string PropertiesExcludedForTableview = @"Id,Type"; private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + private static string SelectedBySuffix = @"#Multiple"; + protected override void ProcessRecord() { try @@ -76,7 +78,7 @@ private static View CreateViewModel(ViewParameters viewParameters) Name = viewParameters.Type.FullName, ViewSelectedBy = new ViewSelectedBy { - TypeName = viewParameters.Type.FullName + TypeName = string.Concat(viewParameters.Type.FullName, SelectedBySuffix) }, TableControl = new TableControl { diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs index 4ab81d3f86e3..432e3489b8fd 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs @@ -33,6 +33,9 @@ public class ExportHelpMarkdown : PSCmdlet [ValidateNotNullOrEmpty] public string ExamplesFolder { get; set; } + [Parameter()] + public SwitchParameter AddComplexInterfaceInfo { get; set; } + protected override void ProcessRecord() { try @@ -41,7 +44,7 @@ protected override void ProcessRecord() var variantGroups = FunctionInfo.Select(fi => fi.BaseObject).Cast() .Join(helpInfos, fi => fi.Name, phi => phi.CmdletName, (fi, phi) => fi.ToVariants(phi)) .Select(va => new VariantGroup(ModuleInfo.Name, va.First().CmdletName, va, String.Empty)); - WriteMarkdowns(variantGroups, ModuleInfo.ToModuleInfo(), DocsFolder, ExamplesFolder); + WriteMarkdowns(variantGroups, ModuleInfo.ToModuleInfo(), DocsFolder, ExamplesFolder, AddComplexInterfaceInfo.IsPresent); } catch (Exception ee) { diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs index f03605feba4c..0aafb1685543 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs @@ -24,7 +24,7 @@ public class ExportModelSurface : PSCmdlet public bool UseExpandedFormat { get; set; } private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models"; - private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support"; + private const string SupportNamespace = @"${$project.supportNamespace.fullName}"; protected override void ProcessRecord() { diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs index fb2885c33f81..81896b969396 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs @@ -52,6 +52,9 @@ public class ExportProxyCmdlet : PSCmdlet [Parameter(Mandatory = true, ParameterSetName = "NoDocs")] public SwitchParameter ExcludeDocs { get; set; } + [Parameter(ParameterSetName = "Docs")] + public SwitchParameter AddComplexInterfaceInfo { get; set; } + protected override void ProcessRecord() { try @@ -163,7 +166,7 @@ protected override void ProcessRecord() var isValidProfile = !String.IsNullOrEmpty(profileName) && profileName != NoProfiles; var docsFolder = isValidProfile ? Path.Combine(DocsFolder, profileName) : DocsFolder; var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, profileName) : ExamplesFolder; - WriteMarkdowns(variantGroupsByProfile, moduleInfo, docsFolder, examplesFolder); + WriteMarkdowns(variantGroupsByProfile, moduleInfo, docsFolder, examplesFolder, AddComplexInterfaceInfo.IsPresent); } } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs index ee136015b876..dc0b9aa2deb5 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs @@ -137,7 +137,7 @@ protected override void ProcessRecord() } else { - var cmdletsList = functionInfos.Select(fi => fi.Name).Distinct().Append("*").ToPsList(); + var cmdletsList = functionInfos.Select(fi => fi.Name).Distinct().ToPsList(); sb.AppendLine($@"{Indent}FunctionsToExport = {cmdletsList}"); } @@ -148,8 +148,10 @@ protected override void ProcessRecord() } else { - var aliasesList = functionInfos.SelectMany(fi => fi.ScriptBlock.Attributes).ToAliasNames().Append("*").ToPsList(); - sb.AppendLine($@"{Indent}AliasesToExport = {aliasesList}"); + var aliasesList = functionInfos.SelectMany(fi => fi.ScriptBlock.Attributes).ToAliasNames().ToPsList(); + if (!String.IsNullOrEmpty(aliasesList)) { + sb.AppendLine($@"{Indent}AliasesToExport = {aliasesList}"); + } } // CmdletsToExport @@ -163,7 +165,7 @@ protected override void ProcessRecord() if (previewVersion != null) { - sb.AppendLine($@"{Indent}{Indent}{Indent}Prerelease = {previewVersion}"); + sb.AppendLine($@"{Indent}{Indent}{Indent}Prerelease = '{previewVersion}'"); } sb.AppendLine($@"{Indent}{Indent}{Indent}Tags = {"Azure ResourceManager ARM PSModule Marketplace".Split(' ').ToPsList().NullIfEmpty() ?? "''"}"); sb.AppendLine($@"{Indent}{Indent}{Indent}LicenseUri = '{"https://aka.ms/azps-license"}'"); diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs index 77f1cf890c08..1e7a02b27a47 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs @@ -56,6 +56,31 @@ protected override void ProcessRecord() return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) } } +function Start-TestSleep { + [CmdletBinding(DefaultParameterSetName = 'SleepBySeconds')] + param( + [parameter(Mandatory = $true, Position = 0, ParameterSetName = 'SleepBySeconds')] + [ValidateRange(0.0, 2147483.0)] + [double] $Seconds, + + [parameter(Mandatory = $true, ParameterSetName = 'SleepByMilliseconds')] + [ValidateRange('NonNegative')] + [Alias('ms')] + [int] $Milliseconds + ) + + if ($TestMode -ne 'playback') { + switch ($PSCmdlet.ParameterSetName) { + 'SleepBySeconds' { + Start-Sleep -Seconds $Seconds + } + 'SleepByMilliseconds' { + Start-Sleep -Milliseconds $Milliseconds + } + } + } +} + $env = @{} if ($UsePreviousConfigForRecord) { $previousEnv = Get-Content (Join-Path $PSScriptRoot 'env.json') | ConvertFrom-Json diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs index 1085c2608d20..5ee0a99492b1 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs @@ -14,7 +14,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell { internal static class MarkdownRenderer { - public static void WriteMarkdowns(IEnumerable variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder) + public static void WriteMarkdowns(IEnumerable variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder, bool AddComplexInterfaceInfo = true) { Directory.CreateDirectory(docsFolder); var markdownInfos = variantGroups.Where(vg => !vg.IsInternal).Select(vg => new MarkdownHelpInfo(vg, examplesFolder)).OrderBy(mhi => mhi.CmdletName).ToArray(); @@ -69,18 +69,26 @@ public static void WriteMarkdowns(IEnumerable variantGroups, PsMod } sb.Append($"## NOTES{Environment.NewLine}{Environment.NewLine}"); - sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}"); - foreach (var alias in markdownInfo.Aliases) + if (markdownInfo.Aliases.Any()) { - sb.Append($"{alias}{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}"); } - if (markdownInfo.ComplexInterfaceInfos.Any()) + foreach (var alias in markdownInfo.Aliases) { - sb.Append($"{ComplexParameterHeader}{Environment.NewLine}"); + sb.Append($"{alias}{Environment.NewLine}{Environment.NewLine}"); } - foreach (var complexInterfaceInfo in markdownInfo.ComplexInterfaceInfos) + + if (AddComplexInterfaceInfo) { - sb.Append($"{complexInterfaceInfo.ToNoteOutput(includeDashes: true, includeBackticks: true)}{Environment.NewLine}{Environment.NewLine}"); + if (markdownInfo.ComplexInterfaceInfos.Any()) + { + sb.Append($"{ComplexParameterHeader}{Environment.NewLine}"); + } + foreach (var complexInterfaceInfo in markdownInfo.ComplexInterfaceInfos) + { + sb.Append($"{complexInterfaceInfo.ToNoteOutput(includeDashes: true, includeBackticks: true)}{Environment.NewLine}{Environment.NewLine}"); + } + } sb.Append($"## RELATED LINKS{Environment.NewLine}{Environment.NewLine}"); diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs index f144b918f7c2..1c9cfe4227e0 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs @@ -52,6 +52,17 @@ public override string ToString() internal class HelpExampleOutput { + private string ExampleTemplate = + "{0}{1}" + Environment.NewLine + + "{2}" + Environment.NewLine + "{3}" + Environment.NewLine + "{4}" + Environment.NewLine + Environment.NewLine + + "{5}" + Environment.NewLine + Environment.NewLine; + + private string ExampleTemplateWithOutput = + "{0}{1}" + Environment.NewLine + + "{2}" + Environment.NewLine + "{3}" + Environment.NewLine + "{4}" + Environment.NewLine + Environment.NewLine + + "{5}" + Environment.NewLine + "{6}" + Environment.NewLine + "{7}" + Environment.NewLine + Environment.NewLine + + "{8}" + Environment.NewLine + Environment.NewLine; + public MarkdownExampleHelpInfo ExampleInfo { get; } public HelpExampleOutput(MarkdownExampleHelpInfo exampleInfo) @@ -59,17 +70,26 @@ public HelpExampleOutput(MarkdownExampleHelpInfo exampleInfo) ExampleInfo = exampleInfo; } - public override string ToString() => $@"{ExampleNameHeader}{ExampleInfo.Name} -{ExampleCodeHeader} -{ExampleInfo.Code} -{ExampleCodeFooter} - -{ExampleInfo.Description.ToDescriptionFormat()} - -"; + public override string ToString() + { + if (string.IsNullOrEmpty(ExampleInfo.Output)) + { + return string.Format(ExampleTemplate, + ExampleNameHeader, ExampleInfo.Name, + ExampleCodeHeader, ExampleInfo.Code, ExampleCodeFooter, + ExampleInfo.Description.ToDescriptionFormat()); + } + else + { + return string.Format(ExampleTemplateWithOutput, + ExampleNameHeader, ExampleInfo.Name, + ExampleCodeHeader, ExampleInfo.Code, ExampleCodeFooter, + ExampleOutputHeader, ExampleInfo.Output, ExampleOutputFooter, + ExampleInfo.Description.ToDescriptionFormat()); ; + } + } } - - + internal class HelpParameterOutput { public MarkdownParameterHelpInfo ParameterInfo { get; } @@ -141,7 +161,7 @@ public ModulePageCmdletOutput(MarkdownHelpInfo helpInfo) } public override string ToString() => $@"### [{HelpInfo.CmdletName}]({HelpInfo.CmdletName}.md) -{HelpInfo.Description.ToDescriptionFormat()} +{HelpInfo.Synopsis.ToDescriptionFormat()} "; } @@ -161,6 +181,8 @@ public static string ToDescriptionFormat(this string text, bool escapeAngleBrack public const string ExampleNameHeader = "### "; public const string ExampleCodeHeader = "```powershell"; public const string ExampleCodeFooter = "```"; + public const string ExampleOutputHeader = "```output"; + public const string ExampleOutputFooter = "```"; public static HelpMetadataOutput ToHelpMetadataOutput(this MarkdownHelpInfo helpInfo) => new HelpMetadataOutput(helpInfo); diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs index e40aa99b0a3f..be641dfe3a77 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs @@ -109,18 +109,21 @@ internal class PsHelpExampleInfo { public string Title { get; } public string Code { get; } + public string Output { get; } public string Remarks { get; } public PsHelpExampleInfo(PSObject exampleObject) { Title = exampleObject.GetProperty("title"); Code = exampleObject.GetProperty("code"); + Output = exampleObject.GetProperty("output"); Remarks = exampleObject.GetProperty("remarks").EmptyIfNull().ToDescriptionText(); } public PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample) { Title = markdownExample.Name; Code = markdownExample.Code; + Output = markdownExample.Output; Remarks = markdownExample.Description; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs index d4d3efba7f6d..8d510fd5c5b1 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs @@ -31,7 +31,7 @@ internal class MarkdownHelpInfo public string[] Inputs { get; } public string[] Outputs { get; } public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } - public string[] RelatedLinks { get; } + public MarkdownRelatedLinkInfo[] RelatedLinks { get; } public bool SupportsShouldProcess { get; } public bool SupportsPaging { get; } @@ -39,7 +39,7 @@ internal class MarkdownHelpInfo public MarkdownHelpInfo(VariantGroup variantGroup, string examplesFolder, string externalHelpFilename = "") { ExternalHelpFilename = externalHelpFilename; - ModuleName = variantGroup.ModuleName; + ModuleName = variantGroup.RootModuleName != "" ? variantGroup.RootModuleName : variantGroup.ModuleName; var helpInfo = variantGroup.HelpInfo; var commentInfo = variantGroup.CommentInfo; Schema = Version.Parse("2.0.0"); @@ -67,7 +67,11 @@ public MarkdownHelpInfo(VariantGroup variantGroup, string examplesFolder, string ComplexInterfaceInfos = variantGroup.ComplexInterfaceInfos; OnlineVersion = commentInfo.OnlineVersion; - RelatedLinks = commentInfo.RelatedLinks; + + var relatedLinkLists = new List(); + relatedLinkLists.AddRange(commentInfo.RelatedLinks?.Select(link => new MarkdownRelatedLinkInfo(link))); + relatedLinkLists.AddRange(variantGroup.Variants.SelectMany(v => v.Attributes).OfType()?.Distinct()?.Select(link => new MarkdownRelatedLinkInfo(link.Url, link.Description))); + RelatedLinks = relatedLinkLists?.ToArray(); SupportsShouldProcess = variantGroup.SupportsShouldProcess; SupportsPaging = variantGroup.SupportsPaging; @@ -91,12 +95,17 @@ private MarkdownExampleHelpInfo[] GetExamplesFromMarkdown(string examplesFolder) var code = codeStartIndex.HasValue && codeEndIndex.HasValue ? String.Join(Environment.NewLine, eg.Skip(codeStartIndex.Value + 1).Take(codeEndIndex.Value - (codeStartIndex.Value + 1))) : String.Empty; - var descriptionStartIndex = (codeEndIndex ?? 0) + 1; + var outputStartIndex = eg.Select((l, i) => l.StartsWith(ExampleOutputHeader) ? (int?)i : null).FirstOrDefault(i => i.HasValue); + var outputEndIndex = eg.Select((l, i) => l.StartsWith(ExampleOutputFooter) ? (int?)i : null).FirstOrDefault(i => i.HasValue && i > outputStartIndex); + var output = outputStartIndex.HasValue && outputEndIndex.HasValue + ? String.Join(Environment.NewLine, eg.Skip(outputStartIndex.Value + 1).Take(outputEndIndex.Value - (outputStartIndex.Value + 1))) + : String.Empty; + var descriptionStartIndex = (outputEndIndex ?? (codeEndIndex ?? 0)) + 1; descriptionStartIndex = String.IsNullOrWhiteSpace(eg[descriptionStartIndex]) ? descriptionStartIndex + 1 : descriptionStartIndex; var descriptionEndIndex = eg.Length - 1; descriptionEndIndex = String.IsNullOrWhiteSpace(eg[descriptionEndIndex]) ? descriptionEndIndex - 1 : descriptionEndIndex; var description = String.Join(Environment.NewLine, eg.Skip(descriptionStartIndex).Take((descriptionEndIndex + 1) - descriptionStartIndex)); - return new MarkdownExampleHelpInfo(name, code, description); + return new MarkdownExampleHelpInfo(name, code, output, description); }).ToArray(); } } @@ -154,12 +163,14 @@ internal class MarkdownExampleHelpInfo { public string Name { get; } public string Code { get; } + public string Output { get; } public string Description { get; } - public MarkdownExampleHelpInfo(string name, string code, string description) + public MarkdownExampleHelpInfo(string name, string code, string output, string description) { Name = name; Code = code; + Output = output; Description = description; } } @@ -211,14 +222,45 @@ public MarkdownParameterHelpInfo(PsParameterHelpInfo[] parameterHelpInfos, Param } } + internal class MarkdownRelatedLinkInfo + { + public string Url { get; } + public string Description { get; } + + public MarkdownRelatedLinkInfo(string url) + { + Url = url; + } + + public MarkdownRelatedLinkInfo(string url, string description) + { + Url = url; + Description = description; + } + + public override string ToString() + { + if (string.IsNullOrEmpty(Description)) + { + return Url; + } + else + { + return $@"[{Description}]({Url})"; + + } + + } + } + internal static class MarkdownTypesExtensions { - public static MarkdownExampleHelpInfo ToExampleHelpInfo(this PsHelpExampleInfo exampleInfo) => new MarkdownExampleHelpInfo(exampleInfo.Title, exampleInfo.Code, exampleInfo.Remarks); + public static MarkdownExampleHelpInfo ToExampleHelpInfo(this PsHelpExampleInfo exampleInfo) => new MarkdownExampleHelpInfo(exampleInfo.Title, exampleInfo.Code, exampleInfo.Output, exampleInfo.Remarks); public static MarkdownExampleHelpInfo[] DefaultExampleHelpInfos = { - new MarkdownExampleHelpInfo("Example 1: {{ Add title here }}", $@"PS C:\> {{{{ Add code here }}}}{Environment.NewLine}{Environment.NewLine}{{{{ Add output here }}}}", @"{{ Add description here }}"), - new MarkdownExampleHelpInfo("Example 2: {{ Add title here }}", $@"PS C:\> {{{{ Add code here }}}}{Environment.NewLine}{Environment.NewLine}{{{{ Add output here }}}}", @"{{ Add description here }}") + new MarkdownExampleHelpInfo("Example 1: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here (remove the output block if the example doesn't have an output) }}}}", @"{{ Add description here }}"), + new MarkdownExampleHelpInfo("Example 2: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here (remove the output block if the example doesn't have an output) }}}}", @"{{ Add description here }}"), }; public static MarkdownParameterHelpInfo[] SupportsShouldProcessParameters = diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs index 0472203aa6bc..a1cc2b39c60a 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs @@ -121,6 +121,21 @@ public override string ToString() => CompleterInfo != null : String.Empty; } + internal class PSArgumentCompleterOutput : ArgumentCompleterOutput + { + public PSArgumentCompleterInfo PSArgumentCompleterInfo { get; } + + public PSArgumentCompleterOutput(PSArgumentCompleterInfo completerInfo) : base(completerInfo) + { + PSArgumentCompleterInfo = completerInfo; + } + + + public override string ToString() => PSArgumentCompleterInfo != null + ? $"{Indent}[{typeof(PSArgumentCompleterAttribute)}({(PSArgumentCompleterInfo.IsTypeCompleter ? $"[{PSArgumentCompleterInfo.Type.Unwrap().ToPsType()}]" : $"{PSArgumentCompleterInfo.ResourceTypes?.Select(r => $"\"{r}\"")?.JoinIgnoreEmpty(", ")}")})]{Environment.NewLine}" + : String.Empty; + } + internal class DefaultInfoOutput { public bool HasDefaultInfo { get; } @@ -168,18 +183,62 @@ public ParameterNameOutput(string parameterName, bool isLast) public override string ToString() => $"{Indent}${{{ParameterName}}}{(IsLast ? String.Empty : $",{Environment.NewLine}")}{Environment.NewLine}"; } - internal class BeginOutput + internal class BaseOutput { public VariantGroup VariantGroup { get; } - public BeginOutput(VariantGroup variantGroup) + protected static readonly bool IsAzure = Convert.ToBoolean(@"true"); + public BaseOutput(VariantGroup variantGroup) { VariantGroup = variantGroup; } + public string ClearTelemetryContext() + { + return (!VariantGroup.IsInternal && IsAzure) ? $@"{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext()" : ""; + } + } + + internal class BeginOutput : BaseOutput + { + public BeginOutput(VariantGroup variantGroup) : base(variantGroup) + { + } public string GetProcessCustomAttributesAtRuntime() { - return VariantGroup.IsInternal ? "" : $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet]{Environment.NewLine}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)"; + return VariantGroup.IsInternal ? "" : IsAzure ? $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet] +{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){{ +{Indent}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) +{Indent}{Indent}}}" : $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet]{Environment.NewLine}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)"; + } + + private string GetTelemetry() + { + if (!VariantGroup.IsInternal && IsAzure) + { + return $@" +{Indent}{Indent}if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {{ +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() +{Indent}{Indent}}} +{Indent}{Indent}$preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId +{Indent}{Indent}if ($preTelemetryId -eq '') {{ +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() +{Indent}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}}} else {{ +{Indent}{Indent}{Indent}$internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets +{Indent}{Indent}{Indent}if ($internalCalledCmdlets -eq '') {{ +{Indent}{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name +{Indent}{Indent}{Indent}}} else {{ +{Indent}{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name +{Indent}{Indent}{Indent}}} +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' +{Indent}{Indent}}} +"; + } + return ""; } public override string ToString() => $@"begin {{ {Indent}try {{ @@ -188,6 +247,7 @@ public override string ToString() => $@"begin {{ {Indent}{Indent}{Indent}$PSBoundParameters['OutBuffer'] = 1 {Indent}{Indent}}} {Indent}{Indent}$parameterSet = $PSCmdlet.ParameterSetName +{GetTelemetry()} {GetParameterSetToCmdletMapping()}{GetDefaultValuesStatements()} {GetProcessCustomAttributesAtRuntime()} {Indent}{Indent}$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) @@ -195,6 +255,7 @@ public override string ToString() => $@"begin {{ {Indent}{Indent}$steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) {Indent}{Indent}$steppablePipeline.Begin($PSCmdlet) {Indent}}} catch {{ +{ClearTelemetryContext()} {Indent}{Indent}throw {Indent}}} }} @@ -223,7 +284,12 @@ private string GetDefaultValuesStatements() var variantListString = defaultInfo.ParameterGroup.VariantNames.ToPsList(); var parameterName = defaultInfo.ParameterGroup.ParameterName; sb.AppendLine(); - sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}')) {{"); + var setCondition = " "; + if (!String.IsNullOrEmpty(defaultInfo.SetCondition)) + { + setCondition = $" -and {defaultInfo.SetCondition}"; + } + sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}'){setCondition}) {{"); sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}"); sb.Append($"{Indent}{Indent}}}"); } @@ -231,28 +297,69 @@ private string GetDefaultValuesStatements() } } - internal class ProcessOutput + internal class ProcessOutput : BaseOutput { + public ProcessOutput(VariantGroup variantGroup) : base(variantGroup) + { + } + + private string GetFinally() + { + if (IsAzure && !VariantGroup.IsInternal) + { + return $@" +{Indent}finally {{ +{Indent}{Indent}$backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId +{Indent}{Indent}$backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() +{Indent}}} +"; + } + return ""; + } public override string ToString() => $@"process {{ {Indent}try {{ {Indent}{Indent}$steppablePipeline.Process($_) {Indent}}} catch {{ +{ClearTelemetryContext()} {Indent}{Indent}throw {Indent}}} +{GetFinally()} }} - "; } - internal class EndOutput + internal class EndOutput : BaseOutput { + public EndOutput(VariantGroup variantGroup) : base(variantGroup) + { + } + + private string GetTelemetry() + { + if (!VariantGroup.IsInternal && IsAzure) + { + return $@" +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets +{Indent}{Indent}if ($preTelemetryId -eq '') {{ +{Indent}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Marketplace.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() +{Indent}{Indent}}} +{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId +"; + } + return ""; + } public override string ToString() => $@"end {{ {Indent}try {{ {Indent}{Indent}$steppablePipeline.End() +{GetTelemetry()} {Indent}}} catch {{ +{ClearTelemetryContext()} {Indent}{Indent}throw {Indent}}} -}} +}} "; } @@ -277,6 +384,8 @@ public override string ToString() var notesText = !String.IsNullOrEmpty(notes) ? $"{Environment.NewLine}.Notes{Environment.NewLine}{ComplexParameterHeader}{notes}" : String.Empty; var relatedLinks = String.Join(Environment.NewLine, CommentInfo.RelatedLinks.Select(l => $".Link{Environment.NewLine}{l}")); var relatedLinksText = !String.IsNullOrEmpty(relatedLinks) ? $"{Environment.NewLine}{relatedLinks}" : String.Empty; + var externalUrls = String.Join(Environment.NewLine, CommentInfo.ExternalUrls.Select(l => $".Link{Environment.NewLine}{l}")); + var externalUrlsText = !String.IsNullOrEmpty(externalUrls) ? $"{Environment.NewLine}{externalUrls}" : String.Empty; var examples = ""; foreach (var example in VariantGroup.HelpInfo.Examples) { @@ -289,7 +398,7 @@ public override string ToString() {CommentInfo.Description.ToDescriptionFormat(false)} {examples}{inputsText}{outputsText}{notesText} .Link -{CommentInfo.OnlineVersion}{relatedLinksText} +{CommentInfo.OnlineVersion}{relatedLinksText}{externalUrlsText} #> "; } @@ -483,7 +592,9 @@ public static string ToSyntaxTypeName(this Type type) public static AllowEmptyArrayOutput ToAllowEmptyArray(this bool hasAllowEmptyArray) => new AllowEmptyArrayOutput(hasAllowEmptyArray); - public static ArgumentCompleterOutput ToArgumentCompleterOutput(this CompleterInfo completerInfo) => new ArgumentCompleterOutput(completerInfo); + public static ArgumentCompleterOutput ToArgumentCompleterOutput(this CompleterInfo completerInfo) => (completerInfo is PSArgumentCompleterInfo psArgumentCompleterInfo) ? psArgumentCompleterInfo.ToArgumentCompleterOutput() : new ArgumentCompleterOutput(completerInfo); + + public static PSArgumentCompleterOutput ToArgumentCompleterOutput(this PSArgumentCompleterInfo completerInfo) => new PSArgumentCompleterOutput(completerInfo); public static DefaultInfoOutput ToDefaultInfoOutput(this ParameterGroup parameterGroup) => new DefaultInfoOutput(parameterGroup); @@ -493,9 +604,9 @@ public static string ToSyntaxTypeName(this Type type) public static BeginOutput ToBeginOutput(this VariantGroup variantGroup) => new BeginOutput(variantGroup); - public static ProcessOutput ToProcessOutput(this VariantGroup variantGroup) => new ProcessOutput(); + public static ProcessOutput ToProcessOutput(this VariantGroup variantGroup) => new ProcessOutput(variantGroup); - public static EndOutput ToEndOutput(this VariantGroup variantGroup) => new EndOutput(); + public static EndOutput ToEndOutput(this VariantGroup variantGroup) => new EndOutput(variantGroup); public static HelpCommentOutput ToHelpCommentOutput(this VariantGroup variantGroup) => new HelpCommentOutput(variantGroup); @@ -524,7 +635,7 @@ string RenderProperty(ComplexInterfaceInfo info, string indent, bool dash, bool return ni.IsComplexInterface ? ni.ToNoteOutput(nestedIndent, includeDashes, includeBackticks, false) : RenderProperty(ni, nestedIndent, includeDashes, includeBackticks); - }).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes, !isFirst && includeBackticks)); + }).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes, includeBackticks)); return String.Join(Environment.NewLine, nested); } } diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs index f1e853df2e48..1cc566de6091 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs @@ -30,6 +30,8 @@ public ProfileGroup(Variant[] variants, string profileName = NoProfiles) internal class VariantGroup { public string ModuleName { get; } + + public string RootModuleName {get => @"";} public string CmdletName { get; } public string CmdletVerb { get; } public string CmdletNoun { get; } @@ -99,12 +101,23 @@ private string DetermineDefaultParameterSetName() if (String.IsNullOrEmpty(defaultParameterSet)) { var variantParamCountGroups = Variants + .Where(v => !v.IsNotSuggestDefaultParameterSet) .Select(v => ( variant: v.VariantName, paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory), isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple()))) .GroupBy(vpc => vpc.isSimple) .ToArray(); + if (variantParamCountGroups.Length == 0) + { + variantParamCountGroups = Variants + .Select(v => ( + variant: v.VariantName, + paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory), + isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple()))) + .GroupBy(vpc => vpc.isSimple) + .ToArray(); + } var variantParameterCounts = (variantParamCountGroups.Any(g => g.Key) ? variantParamCountGroups.Where(g => g.Key) : variantParamCountGroups).SelectMany(g => g).ToArray(); var smallestParameterCount = variantParameterCounts.Min(vpc => vpc.paramCount); defaultParameterSet = variantParameterCounts.First(vpc => vpc.paramCount == smallestParameterCount).variant; @@ -133,6 +146,7 @@ internal class Variant public Parameter[] CmdletOnlyParameters { get; } public bool IsInternal { get; } public bool IsDoNotExport { get; } + public bool IsNotSuggestDefaultParameterSet { get; } public string[] Profiles { get; } public Variant(string cmdletName, string variantName, CommandInfo info, CommandMetadata metadata, bool hasParameterSets = false, PsHelpInfo helpInfo = null) @@ -153,6 +167,7 @@ public Variant(string cmdletName, string variantName, CommandInfo info, CommandM Parameters = this.ToParameters().OrderBy(p => p.OrderCategory).ThenByDescending(p => p.IsMandatory).ToArray(); IsInternal = Attributes.OfType().Any(); IsDoNotExport = Attributes.OfType().Any(); + IsNotSuggestDefaultParameterSet = Attributes.OfType().Any(); CmdletOnlyParameters = Parameters.Where(p => !p.Categories.Any(c => c == ParameterCategory.Azure || c == ParameterCategory.Runtime)).ToArray(); Profiles = Attributes.OfType().SelectMany(pa => pa.Profiles).ToArray(); } @@ -208,6 +223,7 @@ public ParameterGroup(string parameterName, Parameter[] parameters, string[] all HasValidateNotNull = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); HasAllowEmptyArray = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); CompleterInfo = Parameters.Select(p => p.CompleterInfoAttribute).FirstOrDefault()?.ToCompleterInfo() + ?? Parameters.Select(p => p.PSArgumentCompleterAttribute).FirstOrDefault()?.ToPSArgumentCompleterInfo() ?? Parameters.Select(p => p.ArgumentCompleterAttribute).FirstOrDefault()?.ToCompleterInfo(); DefaultInfo = Parameters.Select(p => p.DefaultInfoAttribute).FirstOrDefault()?.ToDefaultInfo(this) ?? Parameters.Select(p => p.DefaultValueAttribute).FirstOrDefault(dv => dv != null)?.ToDefaultInfo(this); @@ -252,6 +268,7 @@ internal class Parameter public bool SupportsWildcards { get; } public CompleterInfoAttribute CompleterInfoAttribute { get; } public ArgumentCompleterAttribute ArgumentCompleterAttribute { get; } + public PSArgumentCompleterAttribute PSArgumentCompleterAttribute { get; } public bool ValueFromPipeline { get; } public bool ValueFromPipelineByPropertyName { get; } @@ -284,7 +301,8 @@ public Parameter(string variantName, string parameterName, ParameterMetadata met } SupportsWildcards = Attributes.OfType().Any(); CompleterInfoAttribute = Attributes.OfType().FirstOrDefault(); - ArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(); + PSArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(); + ArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(attr => !attr.GetType().Equals(typeof(PSArgumentCompleterAttribute))); ValueFromPipeline = ParameterAttribute.ValueFromPipeline; ValueFromPipelineByPropertyName = ParameterAttribute.ValueFromPipelineByPropertyName; @@ -364,6 +382,7 @@ internal class CommentInfo public string OnlineVersion { get; } public string[] RelatedLinks { get; } + public string[] ExternalUrls { get; } private const string HelpLinkPrefix = @"https://learn.microsoft.com/powershell/module/"; @@ -385,8 +404,13 @@ public CommentInfo(VariantGroup variantGroup) helpInfo.OutputTypes.Where(it => it.Name.NullIfWhiteSpace() != null).Select(ot => ot.Name).ToArray()) .Where(o => o != "None").Distinct().OrderBy(o => o).ToArray(); - OnlineVersion = helpInfo.OnlineVersion?.Uri.NullIfEmpty() ?? $@"{HelpLinkPrefix}{variantGroup.ModuleName.ToLowerInvariant()}/{variantGroup.CmdletName.ToLowerInvariant()}"; + // Use root module name in the help link + var moduleName = variantGroup.RootModuleName == "" ? variantGroup.ModuleName.ToLowerInvariant() : variantGroup.RootModuleName.ToLowerInvariant(); + OnlineVersion = helpInfo.OnlineVersion?.Uri.NullIfEmpty() ?? $@"{HelpLinkPrefix}{moduleName}/{variantGroup.CmdletName.ToLowerInvariant()}"; RelatedLinks = helpInfo.RelatedLinks.Select(rl => rl.Text).ToArray(); + + // Get external urls from attribute + ExternalUrls = variantGroup.Variants.SelectMany(v => v.Attributes).OfType()?.Select(e => e.Url)?.Distinct()?.ToArray(); } } @@ -416,11 +440,22 @@ public CompleterInfo(ArgumentCompleterAttribute completerAttribute) } } + internal class PSArgumentCompleterInfo: CompleterInfo + { + public string[] ResourceTypes { get; } + + public PSArgumentCompleterInfo(PSArgumentCompleterAttribute completerAttribute) : base(completerAttribute) + { + ResourceTypes = completerAttribute.ResourceTypes; + } + } + internal class DefaultInfo { public string Name { get; } public string Description { get; } public string Script { get; } + public string SetCondition { get; } public ParameterGroup ParameterGroup { get; } public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) @@ -428,6 +463,7 @@ public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterG Name = infoAttribute.Name; Description = infoAttribute.Description; Script = infoAttribute.Script; + SetCondition = infoAttribute.SetCondition; ParameterGroup = parameterGroup; } @@ -503,7 +539,7 @@ public static ComplexInterfaceInfo ToComplexInterfaceInfo(this InfoAttribute inf public static CompleterInfo ToCompleterInfo(this CompleterInfoAttribute infoAttribute) => new CompleterInfo(infoAttribute); public static CompleterInfo ToCompleterInfo(this ArgumentCompleterAttribute completerAttribute) => new CompleterInfo(completerAttribute); - + public static PSArgumentCompleterInfo ToPSArgumentCompleterInfo(this PSArgumentCompleterAttribute completerAttribute) => new PSArgumentCompleterInfo(completerAttribute); public static DefaultInfo ToDefaultInfo(this DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) => new DefaultInfo(infoAttribute, parameterGroup); public static DefaultInfo ToDefaultInfo(this PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) => new DefaultInfo(defaultValueAttribute, parameterGroup); } diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/PsAttributes.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/PsAttributes.cs index 86d8fc11160c..df5a43833757 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/PsAttributes.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/PsAttributes.cs @@ -48,6 +48,18 @@ public ProfileAttribute(params string[] profiles) } } + [AttributeUsage(AttributeTargets.Class)] + public class HttpPathAttribute : Attribute + { + public string Path { get; set; } + public string ApiVersion { get; set; } + } + + [AttributeUsage(AttributeTargets.Class)] + public class NotSuggestDefaultParameterSetAttribute : Attribute + { + } + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] public class CategoryAttribute : Attribute { @@ -102,6 +114,11 @@ public enum PropertyOrigin Inlined } + [AttributeUsage(AttributeTargets.Property)] + public class ConstantAttribute : Attribute + { + } + [AttributeUsage(AttributeTargets.Property)] public class FormatTableAttribute : Attribute { diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/PsExtensions.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/PsExtensions.cs index e8c12a539b14..8611948d5ca6 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/PsExtensions.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/PsExtensions.cs @@ -13,6 +13,13 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.PowerShell { internal static class PsExtensions { + public static PSObject AddMultipleTypeNameIntoPSObject(this object obj, string multipleTag = "#Multiple") + { + var psObj = new PSObject(obj); + psObj.TypeNames.Insert(0, $"{psObj.TypeNames[0]}{multipleTag}"); + return psObj; + } + // https://stackoverflow.com/a/863944/294804 // https://stackoverflow.com/a/4452598/294804 // https://stackoverflow.com/a/28701974/294804 diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/PsHelpers.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/PsHelpers.cs index ad7f54ff2f79..1177fcc5be32 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/PsHelpers.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/BuildTime/PsHelpers.cs @@ -39,9 +39,10 @@ public static IEnumerable GetModuleCmdlets(params string[] modulePa public static IEnumerable GetScriptCmdlets(PSCmdlet cmdlet, string scriptFolder) { // https://stackoverflow.com/a/40969712/294804 + var wrappedFolder = scriptFolder.Contains("'") ? $@"""{scriptFolder}""" : $@"'{scriptFolder}'"; var getCmdletsCommand = $@" $currentFunctions = Get-ChildItem function: -Get-ChildItem -Path '{scriptFolder}' -Recurse -Include '*.ps1' -File | ForEach-Object {{ . $_.FullName }} +Get-ChildItem -Path {wrappedFolder} -Recurse -Include '*.ps1' -File | ForEach-Object {{ . $_.FullName }} Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} "; return cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand); @@ -66,7 +67,7 @@ public static IEnumerable GetScriptHelpInfo(params string[] modulePath public static IEnumerable GetModuleCmdletsAndHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) { - var getCmdletAndHelp = String.Join(" + ", modulePaths.Select(mp => + var getCmdletAndHelp = String.Join(" + ", modulePaths.Select(mp => $@"(Get-Command -Module (Import-Module '{mp}' -PassThru) | Where-Object {{ $_.CommandType -ne 'Alias' }} | ForEach-Object {{ @{{ CommandInfo = $_; HelpInfo = ( invoke-command {{ try {{ Get-Help -Name $_.Name -Full }} catch{{ '' }} }} ) }} }})" )); return (cmdlet?.RunScript(getCmdletAndHelp) ?? RunScript(getCmdletAndHelp)) @@ -87,7 +88,7 @@ public static Guid ReadGuidFromPsd1(string psd1Path) if (File.Exists(psd1Path)) { var currentGuid = File.ReadAllLines(psd1Path) - .FirstOrDefault(l => l.StartsWith(GuidStart))?.Split(new[] { " = " }, StringSplitOptions.RemoveEmptyEntries) + .FirstOrDefault(l => l.TrimStart().StartsWith(GuidStart.TrimStart()))?.Split(new[] { " = " }, StringSplitOptions.RemoveEmptyEntries) .LastOrDefault()?.Replace("'", String.Empty); guid = currentGuid != null ? Guid.Parse(currentGuid) : guid; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/Context.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/Context.cs new file mode 100644 index 000000000000..3caf79554019 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/Context.cs @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime +{ + + using System; + using System.Linq; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData = System.Func; + using static Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Extensions; + + /// + /// The IContext Interface defines the communication mechanism for input customization. + /// + /// + /// In the context, we will have client, pipeline, PSBoundParamters, default EventListener, Cancellation. + /// + public interface IContext + { + System.Management.Automation.InvocationInfo InvocationInformation { get; set; } + System.Threading.CancellationTokenSource CancellationTokenSource { get; set; } + System.Collections.Generic.IDictionary ExtensibleParameters { get; } + HttpPipeline Pipeline { get; set; } + Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Marketplace Client { get; } + } +} diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/Customizations/IJsonSerializable.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/Customizations/IJsonSerializable.cs index 2ce254093a1b..a249e35e9a3e 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/Customizations/IJsonSerializable.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/Customizations/IJsonSerializable.cs @@ -75,12 +75,18 @@ private static JsonNode ToJsonValue(ValueType vValue) return new JsonBoolean(bValue); } - // dates + // dates if (vValue is DateTime dtValue) { return new JsonDate(dtValue); } + // DictionaryEntity struct type + if (vValue is System.Collections.DictionaryEntry deValue) + { + return new JsonObject { { deValue.Key.ToString(), ToJsonValue(deValue.Value) } }; + } + // sorry, no idea. return null; } @@ -113,7 +119,7 @@ private static JsonNode TryToJsonValue(dynamic oValue) // if we got something out, let's use it. if (null != jsonValue) { - // JsonNumber is really a literal json value. Just don't try to cast that back to an actual number, ok? + // JsonNumber is really a literal json value. Just don't try to cast that back to an actual number, ok? return new JsonNumber(jsonValue.ToString()); } @@ -123,11 +129,11 @@ private static JsonNode TryToJsonValue(dynamic oValue) /// /// Serialize an object by using a variety of methods. /// - /// the object to be serialized. + /// the object to be serialized. /// the serialized JsonNode (if successful), otherwise, null internal static JsonNode ToJsonValue(object value) { - // things that implement our interface are preferred. + // things that implement our interface are preferred. if (value is Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IJsonSerializable jsonSerializable) { return jsonSerializable.ToJson(); @@ -139,7 +145,7 @@ internal static JsonNode ToJsonValue(object value) return new JsonString(value.ToString()); } - // value types are fairly straightforward (fallback to ToJson()/ToJsonString() or literal JsonString ) + // value types are fairly straightforward (fallback to ToJson()/ToJsonString() or literal JsonString ) if (value is System.ValueType vValue) { return ToJsonValue(vValue) ?? TryToJsonValue(vValue) ?? new JsonString(vValue.ToString()); @@ -159,7 +165,7 @@ internal static JsonNode ToJsonValue(object value) return Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.JsonSerializable.ToJson(dict, null); } - // enumerable collections are handled like arrays (again, fallback to ToJson()/ToJsonString() or literal JsonString) + // enumerable collections are handled like arrays (again, fallback to ToJson()/ToJsonString() or literal JsonString) if (value is System.Collections.IEnumerable enumerableValue) { // some kind of enumerable value @@ -185,7 +191,7 @@ internal static JsonObject ToJson(System.Collections.Generic.IDictionary /// PowerShell-specific data on top of the llc# EventData /// @@ -16,6 +15,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime /// Obviously, this code would need to be duplcated on both modules. /// This is preferable to sharing a common library, as versioning makes that problematic. /// + [System.ComponentModel.TypeConverter(typeof(EventDataConverter))] public partial class EventData : EventArgs { } diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/Events.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/Events.cs index 77d09f7d2c72..a887fc2d88f9 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/Events.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/Events.cs @@ -22,6 +22,6 @@ public static partial class Events public const string FollowingNextLink = nameof(FollowingNextLink); public const string DelayBeforePolling = nameof(DelayBeforePolling); public const string Polling = nameof(Polling); - + public const string Progress = nameof(Progress); } -} \ No newline at end of file +} diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/ISendAsync.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/ISendAsync.cs index 9367c85b5e44..3e5e539252a4 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/ISendAsync.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/ISendAsync.cs @@ -11,6 +11,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime using System.Threading.Tasks; using System.Collections; using System.Linq; + using System; + /// /// The interface for sending an HTTP request across the wire. @@ -70,6 +72,7 @@ public interface ISendAsyncTerminalFactory public partial class HttpPipeline : ISendAsync { + private const int DefaultMaxRetry = 3; private ISendAsync pipeline; private ISendAsyncTerminalFactory terminal; private List steps = new List(); @@ -92,6 +95,111 @@ public HttpPipeline(ISendAsyncTerminalFactory terminalStep) /// public HttpPipeline Clone() => new HttpPipeline(terminal) { steps = this.steps.ToList(), pipeline = this.pipeline }; + private bool shouldRetry429(HttpResponseMessage response) + { + if (response.StatusCode == (System.Net.HttpStatusCode)429) + { + var retryAfter = response.Headers.RetryAfter; + if (retryAfter != null && retryAfter.Delta.HasValue) + { + return true; + } + } + return false; + } + /// + /// The step to handle 429 response with retry-after header. + /// + public async Task Retry429(HttpRequestMessage request, IEventListener callback, ISendAsync next) + { + int retryCount = int.MaxValue; + + try + { + try + { + retryCount = int.Parse(System.Environment.GetEnvironmentVariable("PS_HTTP_MAX_RETRIES_FOR_429")); + } + finally + { + retryCount = int.Parse(System.Environment.GetEnvironmentVariable("AZURE_PS_HTTP_MAX_RETRIES_FOR_429")); + } + } + catch (System.Exception) + { + //no action + } + var cloneRequest = await request.CloneWithContent(); + var response = await next.SendAsync(request, callback); + int count = 0; + while (shouldRetry429(response) && count++ < retryCount) + { + request = await cloneRequest.CloneWithContent(); + var retryAfter = response.Headers.RetryAfter; + await Task.Delay(retryAfter.Delta.Value, callback.Token); + await callback.Signal("Debug", $"Start to retry {count} time(s) on status code 429 after waiting {retryAfter.Delta.Value.TotalSeconds} seconds."); + response = await next.SendAsync(request, callback); + } + return response; + } + + private bool shouldRetryError(HttpResponseMessage response) + { + if (response.StatusCode >= System.Net.HttpStatusCode.InternalServerError) + { + if (response.StatusCode != System.Net.HttpStatusCode.NotImplemented && + response.StatusCode != System.Net.HttpStatusCode.HttpVersionNotSupported) + { + return true; + } + } + else if (response.StatusCode == System.Net.HttpStatusCode.RequestTimeout) + { + return true; + } + else if (response.StatusCode == (System.Net.HttpStatusCode)429 && response.Headers.RetryAfter == null) + { + return true; + } + return false; + } + + /// + /// Returns true if status code in HttpRequestExceptionWithStatus exception is greater + /// than or equal to 500 and not NotImplemented (501) or HttpVersionNotSupported (505). + /// Or it's 429 (TOO MANY REQUESTS) without Retry-After header. + /// + public async Task RetryError(HttpRequestMessage request, IEventListener callback, ISendAsync next) + { + int retryCount = DefaultMaxRetry; + + try + { + try + { + retryCount = int.Parse(System.Environment.GetEnvironmentVariable("PS_HTTP_MAX_RETRIES")); + } + finally + { + retryCount = int.Parse(System.Environment.GetEnvironmentVariable("AZURE_PS_HTTP_MAX_RETRIES")); + } + } + catch (System.Exception) + { + //no action + } + var cloneRequest = await request.CloneWithContent(); + var response = await next.SendAsync(request, callback); + int count = 0; + while (shouldRetryError(response) && count++ < retryCount) + { + await callback.Signal("Debug", $"Start to retry {count} time(s) on status code {response.StatusCode}"); + request = await cloneRequest.CloneWithContent(); + response = await next.SendAsync(request, callback); + } + return response; + } + public ISendAsyncTerminalFactory TerminalFactory { get => terminal; @@ -117,6 +225,11 @@ public ISendAsync Pipeline // create the pipeline from scratch. var next = terminal.Create(); + if (Convert.ToBoolean(@"true")) + { + next = (new SendAsyncFactory(Retry429)).Create(next) ?? next; + next = (new SendAsyncFactory(RetryError)).Create(next) ?? next; + } foreach (var factory in steps) { // skip factories that return null. @@ -238,6 +351,8 @@ internal static Task CloneWithContentAndDispose(this HttpReq /// Clones an HttpRequestMessage (without the content) /// /// Original HttpRequestMessage (Will be diposed before returning) + /// + /// /// A clone of the HttpRequestMessage internal static HttpRequestMessage Clone(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) { @@ -252,9 +367,9 @@ internal static HttpRequestMessage Clone(this HttpRequestMessage original, Syste { clone.Properties.Add(prop); } - + foreach (KeyValuePair> header in original.Headers) - { + { /* **temporarily skip cloning telemetry related headers** clone.Headers.TryAddWithoutValidation(header.Key, header.Value); @@ -264,7 +379,7 @@ internal static HttpRequestMessage Clone(this HttpRequestMessage original, Syste clone.Headers.TryAddWithoutValidation(header.Key, header.Value); } } - + return clone; } @@ -272,6 +387,8 @@ internal static HttpRequestMessage Clone(this HttpRequestMessage original, Syste /// Clones an HttpRequestMessage (including the content stream and content headers) /// /// Original HttpRequestMessage (Will be diposed before returning) + /// + /// /// A clone of the HttpRequestMessage internal static async Task CloneWithContent(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) { diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/InfoAttribute.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/InfoAttribute.cs index dd4e8b0b9ad2..c622416674b7 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/InfoAttribute.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/InfoAttribute.cs @@ -11,6 +11,9 @@ public class InfoAttribute : Attribute { public bool Required { get; set; } = false; public bool ReadOnly { get; set; } = false; + public bool Read { get; set; } = true; + public bool Create { get; set; } = true; + public bool Update { get; set; } = true; public Type[] PossibleTypes { get; set; } = new Type[0]; public string Description { get; set; } = ""; public string SerializedName { get; set; } = ""; @@ -30,5 +33,6 @@ public class DefaultInfoAttribute : Attribute public string Script { get; set; } = ""; public string Name { get; set; } = ""; public string Description { get; set; } = ""; + public string SetCondition { get; set; } = ""; } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/InputHandler.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/InputHandler.cs new file mode 100644 index 000000000000..f2ef9d31d325 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/InputHandler.cs @@ -0,0 +1,22 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.Cmdlets +{ + public abstract class InputHandler + { + protected InputHandler NextHandler = null; + + public void SetNextHandler(InputHandler nextHandler) + { + this.NextHandler = nextHandler; + } + + public abstract void Process(Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime.IContext context); + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/MessageAttribute.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/MessageAttribute.cs index 2c1482d48ceb..9b6264e22d68 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/MessageAttribute.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/MessageAttribute.cs @@ -21,7 +21,7 @@ public class GenericBreakingChangeAttribute : Attribute //The version the change is effective from, non mandatory public string DeprecateByVersion { get; } - public bool DeprecateByVersionSet { get; } = false; + public string DeprecateByAzVersion { get; } //The date on which the change comes in effect public DateTime ChangeInEfectByDate { get; } @@ -32,23 +32,18 @@ public class GenericBreakingChangeAttribute : Attribute //New way fo calling the cmdlet public string NewWay { get; set; } - public GenericBreakingChangeAttribute(string message) - { - _message = message; - } - - public GenericBreakingChangeAttribute(string message, string deprecateByVersion) + public GenericBreakingChangeAttribute(string message, string deprecateByAzVersion, string deprecateByVersion) { _message = message; + this.DeprecateByAzVersion = deprecateByAzVersion; this.DeprecateByVersion = deprecateByVersion; - this.DeprecateByVersionSet = true; } - public GenericBreakingChangeAttribute(string message, string deprecateByVersion, string changeInEfectByDate) + public GenericBreakingChangeAttribute(string message, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) { _message = message; this.DeprecateByVersion = deprecateByVersion; - this.DeprecateByVersionSet = true; + this.DeprecateByAzVersion = deprecateByAzVersion; if (DateTime.TryParse(changeInEfectByDate, new CultureInfo("en-US"), DateTimeStyles.None, out DateTime result)) { @@ -86,10 +81,8 @@ public void PrintCustomAttributeInfo(Action writeOutput) writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByDateMessage, this.ChangeInEfectByDate.ToString("d"))); } - if (DeprecateByVersionSet) - { - writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByVersion, this.DeprecateByVersion)); - } + writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByAzVersion, this.DeprecateByAzVersion)); + writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByVersion, this.DeprecateByVersion)); if (OldWay != null && NewWay != null) { @@ -114,18 +107,13 @@ public class CmdletBreakingChangeAttribute : GenericBreakingChangeAttribute public string ReplacementCmdletName { get; set; } - public CmdletBreakingChangeAttribute() : - base(string.Empty) + public CmdletBreakingChangeAttribute(string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) { } - public CmdletBreakingChangeAttribute(string deprecateByVersione) : - base(string.Empty, deprecateByVersione) - { - } - - public CmdletBreakingChangeAttribute(string deprecateByVersion, string changeInEfectByDate) : - base(string.Empty, deprecateByVersion, changeInEfectByDate) + public CmdletBreakingChangeAttribute(string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) { } @@ -146,20 +134,15 @@ protected override string GetAttributeSpecificMessage() public class ParameterSetBreakingChangeAttribute : GenericBreakingChangeAttribute { public string[] ChangedParameterSet { set; get; } - public ParameterSetBreakingChangeAttribute(string[] changedParameterSet) : - base(string.Empty) - { - ChangedParameterSet = changedParameterSet; - } - public ParameterSetBreakingChangeAttribute(string[] changedParameterSet, string deprecateByVersione) : - base(string.Empty, deprecateByVersione) + public ParameterSetBreakingChangeAttribute(string[] changedParameterSet, string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) { ChangedParameterSet = changedParameterSet; } - public ParameterSetBreakingChangeAttribute(string[] changedParameterSet, string deprecateByVersion, string changeInEfectByDate) : - base(string.Empty, deprecateByVersion, changeInEfectByDate) + public ParameterSetBreakingChangeAttribute(string[] changedParameterSet, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) { ChangedParameterSet = changedParameterSet; } @@ -185,6 +168,11 @@ public class PreviewMessageAttribute : Attribute { public string _message; + public DateTime EstimatedGaDate { get; } + + public bool IsEstimatedGaDateSet { get; } = false; + + public PreviewMessageAttribute() { this._message = Resources.PreviewCmdletMessage; @@ -192,12 +180,26 @@ public PreviewMessageAttribute() public PreviewMessageAttribute(string message) { - this._message = message; + this._message = string.IsNullOrEmpty(message) ? Resources.PreviewCmdletMessage : message; } - public void PrintCustomAttributeInfo(System.Management.Automation.PSCmdlet psCmdlet) + public PreviewMessageAttribute(string message, string estimatedDateOfGa) : this(message) { - psCmdlet.WriteWarning(this._message); + if (DateTime.TryParse(estimatedDateOfGa, new CultureInfo("en-US"), DateTimeStyles.None, out DateTime result)) + { + this.EstimatedGaDate = result; + this.IsEstimatedGaDateSet = true; + } + } + + public void PrintCustomAttributeInfo(Action writeOutput) + { + writeOutput(this._message); + + if (IsEstimatedGaDateSet) + { + writeOutput(string.Format(Resources.PreviewCmdletETAMessage, this.EstimatedGaDate.ToShortDateString())); + } } public virtual bool IsApplicableToInvocation(InvocationInfo invocation) @@ -219,20 +221,14 @@ public class ParameterBreakingChangeAttribute : GenericBreakingChangeAttribute public String NewParameterType { get; set; } - public ParameterBreakingChangeAttribute(string nameOfParameterChanging) : - base(string.Empty) + public ParameterBreakingChangeAttribute(string nameOfParameterChanging, string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) { this.NameOfParameterChanging = nameOfParameterChanging; } - public ParameterBreakingChangeAttribute(string nameOfParameterChanging, string deprecateByVersion) : - base(string.Empty, deprecateByVersion) - { - this.NameOfParameterChanging = nameOfParameterChanging; - } - - public ParameterBreakingChangeAttribute(string nameOfParameterChanging, string deprecateByVersion, string changeInEfectByDate) : - base(string.Empty, deprecateByVersion, changeInEfectByDate) + public ParameterBreakingChangeAttribute(string nameOfParameterChanging, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) { this.NameOfParameterChanging = nameOfParameterChanging; } @@ -276,7 +272,7 @@ protected override string GetAttributeSpecificMessage() /// then the attribbute is applicable /// If the invocationInfo is null we return true /// - /// + /// /// bool public override bool IsApplicableToInvocation(InvocationInfo invocationInfo) { @@ -298,20 +294,14 @@ public class OutputBreakingChangeAttribute : GenericBreakingChangeAttribute public string[] NewOutputProperties { get; set; } - public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType) : - base(string.Empty) - { - this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputType; - } - - public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType, string deprecateByVersion) : - base(string.Empty, deprecateByVersion) + public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType, string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) { this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputType; } - public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType, string deprecateByVersion, string changeInEfectByDate) : - base(string.Empty, deprecateByVersion, changeInEfectByDate) + public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) { this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputType; } diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/MessageAttributeHelper.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/MessageAttributeHelper.cs index 1d785b4a98cc..3b9befc0a1b5 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/MessageAttributeHelper.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/MessageAttributeHelper.cs @@ -23,6 +23,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Runtime using System.Threading.Tasks; public class MessageAttributeHelper { + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); public const string BREAKING_CHANGE_ATTRIBUTE_INFORMATION_LINK = "https://aka.ms/azps-changewarnings"; public const string SUPPRESS_ERROR_OR_WARNING_MESSAGE_ENV_VARIABLE_NAME = "SuppressAzurePowerShellBreakingChangeWarnings"; @@ -34,7 +35,7 @@ public class MessageAttributeHelper * the boundParameterNames is a list of parameters bound to the cmdlet at runtime, * We only process the Parameter beaking change attributes attached only params listed in this list (if present) * */ - public static void ProcessCustomAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet) + public static void ProcessCustomAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet, bool showPreviewMessage = true) { bool supressWarningOrError = false; @@ -52,37 +53,53 @@ public static void ProcessCustomAttributesAtRuntime(CommandInfo commandInfo, Inv //Do not process the attributes at runtime... The env variable to override the warning messages is set return; } + if (IsAzure && invocationInfo.BoundParameters.ContainsKey("DefaultProfile")) + { + psCmdlet.WriteWarning("The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription."); + } + + ProcessBreakingChangeAttributesAtRuntime(commandInfo, invocationInfo, parameterSet, psCmdlet); + + } + private static void ProcessBreakingChangeAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet) + { List attributes = new List(GetAllBreakingChangeAttributesInType(commandInfo, invocationInfo, parameterSet)); StringBuilder sb = new StringBuilder(); - Action appendBreakingChangeInfo = (string s) => sb.Append(s); + Action appendAttributeMessage = (string s) => sb.Append(s); if (attributes != null && attributes.Count > 0) { - appendBreakingChangeInfo(string.Format(Resources.BreakingChangesAttributesHeaderMessage, commandInfo.Name.Split('_')[0])); + appendAttributeMessage(string.Format(Resources.BreakingChangesAttributesHeaderMessage, commandInfo.Name.Split('_')[0])); foreach (GenericBreakingChangeAttribute attribute in attributes) { - attribute.PrintCustomAttributeInfo(appendBreakingChangeInfo); + attribute.PrintCustomAttributeInfo(appendAttributeMessage); } - appendBreakingChangeInfo(string.Format(Resources.BreakingChangesAttributesFooterMessage, BREAKING_CHANGE_ATTRIBUTE_INFORMATION_LINK)); + appendAttributeMessage(string.Format(Resources.BreakingChangesAttributesFooterMessage, BREAKING_CHANGE_ATTRIBUTE_INFORMATION_LINK)); psCmdlet.WriteWarning(sb.ToString()); } + } + + public static void ProcessPreviewMessageAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet) + { List previewAttributes = new List(GetAllPreviewAttributesInType(commandInfo, invocationInfo)); + StringBuilder sb = new StringBuilder(); + Action appendAttributeMessage = (string s) => sb.Append(s); if (previewAttributes != null && previewAttributes.Count > 0) { foreach (PreviewMessageAttribute attribute in previewAttributes) { - attribute.PrintCustomAttributeInfo(psCmdlet); + attribute.PrintCustomAttributeInfo(appendAttributeMessage); } + psCmdlet.WriteWarning(sb.ToString()); } } - /** * This function takes in a CommandInfo (CmdletInfo or FunctionInfo) * And returns all the deprecation attributes attached to it @@ -124,6 +141,12 @@ private static IEnumerable GetAllBreakingChangeA } return invocationInfo == null ? attributeList : attributeList.Where(e => e.GetType() == typeof(ParameterSetBreakingChangeAttribute) ? ((ParameterSetBreakingChangeAttribute)e).IsApplicableToInvocation(invocationInfo, parameterSet) : e.IsApplicableToInvocation(invocationInfo)); } + + public static bool ContainsPreviewAttribute(CommandInfo commandInfo, InvocationInfo invocationInfo) + { + return GetAllPreviewAttributesInType(commandInfo, invocationInfo)?.Count() > 0; + } + private static IEnumerable GetAllPreviewAttributesInType(CommandInfo commandInfo, InvocationInfo invocationInfo) { List attributeList = new List(); diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs index 523ad01a6ad4..c3b9f4f20147 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/Nodes/Collections/XNodeArray.cs @@ -21,6 +21,11 @@ internal XNodeArray(params JsonNode[] values) items = new List(values); } + internal XNodeArray(System.Collections.Generic.List values) + { + items = new List(values); + } + public override JsonNode this[int index] => items[index]; internal override JsonType? ElementType => null; diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/PipelineMocking.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/PipelineMocking.cs index bbd43641f392..15e5ab1870c1 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/PipelineMocking.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/PipelineMocking.cs @@ -259,4 +259,4 @@ public async Task SendAsync(HttpRequestMessage request, IEv } } } -} \ No newline at end of file +} diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/Properties/Resources.Designer.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/Properties/Resources.Designer.cs index 51e019c559e8..8630b28b5412 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/Properties/Resources.Designer.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/Properties/Resources.Designer.cs @@ -734,7 +734,7 @@ public static string BreakingChangesAttributesInEffectByDateMessage } /// - /// Looks up a localized string similar to Note :The change is expected to take effect from the version : '{0}' + /// Looks up a localized string similar to Note :The change is expected to take effect from version : '{0}' /// ///. /// @@ -746,6 +746,19 @@ public static string BreakingChangesAttributesInEffectByVersion } } + /// + /// Looks up a localized string similar to Note :The change is expected to take effect from az version : '{0}' + /// + ///. + /// + public static string BreakingChangesAttributesInEffectByAzVersion + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesInEffectByAzVersion", resourceCulture); + } + } + /// /// Looks up a localized string similar to ```powershell ///# Old @@ -3122,7 +3135,16 @@ public static string PortalInstructionsGit } /// - /// Looks up a localized string similar to This cmdlet is in preview. The functionality may not be available in the selected subscription. + /// Looks up a localized string similar to The estimated generally available date is '{0}'.. + /// + public static string PreviewCmdletETAMessage { + get { + return ResourceManager.GetString("PreviewCmdletETAMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This cmdlet is in preview. Its behavior is subject to change based on customer feedback.. /// public static string PreviewCmdletMessage { @@ -5630,4 +5652,4 @@ public static string YesHint } } } -} +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/Properties/Resources.resx b/src/Marketplace/Marketplace.Autorest/generated/runtime/Properties/Resources.resx index 598cd53e958a..a08a2e50172b 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/Properties/Resources.resx +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/Properties/Resources.resx @@ -1705,7 +1705,7 @@ Use the Enable-AzureDataCollection cmdlet to turn the feature On. The cmdlet can -- The change is expected to take effect from the version : '{0}' +- The change is expected to take effect from version : '{0}' ```powershell @@ -1736,6 +1736,12 @@ The type of the parameter is changing from '{0}' to '{1}'. Note : Go to {0} for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell. - This cmdlet is in preview. The functionality may not be available in the selected subscription. + This cmdlet is in preview. Its behavior is subject to change based on customer feedback. + + + The estimated generally available date is '{0}'. + + + - The change is expected to take effect from Az version : '{0}' \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/SerializationMode.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/SerializationMode.cs index e908bfa0a974..474a6f0d640c 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/SerializationMode.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/SerializationMode.cs @@ -9,8 +9,10 @@ public enum SerializationMode { None = 0, IncludeHeaders = 1 << 0, - IncludeReadOnly = 1 << 1, - - IncludeAll = IncludeHeaders | IncludeReadOnly + IncludeRead = 1 << 1, + IncludeCreate = 1 << 2, + IncludeUpdate = 1 << 3, + IncludeAll = IncludeHeaders | IncludeRead | IncludeCreate | IncludeUpdate, + IncludeCreateOrUpdate = IncludeCreate | IncludeUpdate } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/TypeConverterExtensions.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/TypeConverterExtensions.cs index fdd2e8877590..05ae9cd4b7e7 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/TypeConverterExtensions.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/TypeConverterExtensions.cs @@ -62,6 +62,56 @@ internal static T[] SelectToArray(object source, System.Func return result.ToArray(); } + internal static System.Collections.Generic.List SelectToList(object source, System.Func converter) + { + // null begets null + if (source == null) + { + return null; + } + + // single values and strings are just encapsulated in the array. + if (source is string || !(source is System.Collections.IEnumerable)) + { + try + { + return new T[] { (T)converter(source) }.ToList(); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + return new T[0].ToList(); // empty result if couldn't convert. + } + + var result = new System.Collections.Generic.List(); + foreach (var each in (System.Collections.IEnumerable)source) + { + try + { + result.Add((T)converter(each)); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + } + return result; + } internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.Generic.IDictionary dictionary) { if (null != dictionary) diff --git a/src/Marketplace/Marketplace.Autorest/generated/runtime/UndeclaredResponseException.cs b/src/Marketplace/Marketplace.Autorest/generated/runtime/UndeclaredResponseException.cs index cb6ee9c44501..1286e7296f63 100644 --- a/src/Marketplace/Marketplace.Autorest/generated/runtime/UndeclaredResponseException.cs +++ b/src/Marketplace/Marketplace.Autorest/generated/runtime/UndeclaredResponseException.cs @@ -63,7 +63,10 @@ public RestException(System.Net.Http.HttpResponseMessage response) catch { // couldn't get the code/message from the body response. - // we'll create one below. + // In this case, we will assume the response is the expected error message + if(!string.IsNullOrEmpty(ResponseBody)) { + message = ResponseBody; + } } #endif if (string.IsNullOrEmpty(message)) diff --git a/src/Marketplace/Marketplace.Autorest/help/Az.Marketplace.md b/src/Marketplace/Marketplace.Autorest/help/Az.Marketplace.md new file mode 100644 index 000000000000..4b82ac497536 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Az.Marketplace.md @@ -0,0 +1,100 @@ +--- +Module Name: Az.Marketplace +Module Guid: 4db1f51a-b835-4783-be47-0b8939492ea5 +Download Help Link: https://learn.microsoft.com/powershell/module/az.marketplace +Help Version: 1.0.0.0 +Locale: en-US +--- + +# Az.Marketplace Module +## Description +Microsoft Azure PowerShell: Marketplace cmdlets + +## Az.Marketplace Cmdlets +### [Copy-AzMarketplacePrivateStoreCollectionOffer](Copy-AzMarketplacePrivateStoreCollectionOffer.md) +transferring offers (copy or move) from source collection to target collection(s) + +### [Disable-AzMarketplacePrivateStoreCollectionAllItem](Disable-AzMarketplacePrivateStoreCollectionAllItem.md) +Disable approve all items for the collection. + +### [Enable-AzMarketplacePrivateStoreCollectionAllItem](Enable-AzMarketplacePrivateStoreCollectionAllItem.md) +Delete all existing offers from the collection and enable approve all items. + +### [Get-AzMarketplaceBillingPrivateStoreAccount](Get-AzMarketplaceBillingPrivateStoreAccount.md) +Tenant billing accounts names + +### [Get-AzMarketplaceCollectionToSubscriptionMapping](Get-AzMarketplaceCollectionToSubscriptionMapping.md) +For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied list. + +### [Get-AzMarketplacePrivateStoreAllSubscriptionInTenant](Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.md) +Fetch all subscriptions in tenant, only for marketplace admin + +### [Get-AzMarketplacePrivateStoreCollection](Get-AzMarketplacePrivateStoreCollection.md) +Gets private store collection + +### [Get-AzMarketplacePrivateStoreCollectionMapOffersToContext](Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.md) +Get a list of all offers in the given collection according to the required contexts. + +### [Get-AzMarketplacePrivateStoreCollectionOffer](Get-AzMarketplacePrivateStoreCollectionOffer.md) +Gets information about a specific offer. + +### [Get-AzMarketplacePrivateStoreCollectionRule](Get-AzMarketplacePrivateStoreCollectionRule.md) +Get a list of all private store rules in the given private store and collection + +### [Get-AzMarketplacePrivateStoreNewPlanNotification](Get-AzMarketplacePrivateStoreNewPlanNotification.md) +List new plans notifications + +### [Get-AzMarketplacePrivateStoreSubscription](Get-AzMarketplacePrivateStoreSubscription.md) +List all the subscriptions in the private store context + +### [Get-AzMarketplacePrivateStoreUserOffer](Get-AzMarketplacePrivateStoreUserOffer.md) +List of user's approved offers for the provided offers and subscriptions + +### [Get-AzMarketplacePrivateStoreUserRule](Get-AzMarketplacePrivateStoreUserRule.md) +All rules approved in the private store that are relevant for user subscriptions + +### [Get-AzMarketplacePrivateStoreV1](Get-AzMarketplacePrivateStoreV1.md) +Get information about the private store + +### [Get-AzMarketplaceQueryPrivateStoreOffer](Get-AzMarketplaceQueryPrivateStoreOffer.md) +List of offers, regardless the collections + +### [New-AzMarketplacePrivateStore](New-AzMarketplacePrivateStore.md) +Changes private store properties + +### [New-AzMarketplacePrivateStoreCollection](New-AzMarketplacePrivateStoreCollection.md) +Create private store collection + +### [New-AzMarketplacePrivateStoreCollectionOffer](New-AzMarketplacePrivateStoreCollectionOffer.md) +Update or add an offer to a specific collection of the private store. + +### [New-AzMarketplacePrivateStoreCollectionOfferMultiContext](New-AzMarketplacePrivateStoreCollectionOfferMultiContext.md) +Upsert an offer with multiple context details. + +### [Remove-AzMarketplacePrivateStoreCollection](Remove-AzMarketplacePrivateStoreCollection.md) +Delete a collection from the given private store. + +### [Remove-AzMarketplacePrivateStoreCollectionOffer](Remove-AzMarketplacePrivateStoreCollectionOffer.md) +Deletes an offer from the given collection of private store. + +### [Set-AzMarketplaceBulkPrivateStoreCollectionAction](Set-AzMarketplaceBulkPrivateStoreCollectionAction.md) +Perform an action on bulk collections + +### [Set-AzMarketplacePrivateStore](Set-AzMarketplacePrivateStore.md) +Changes private store properties + +### [Set-AzMarketplacePrivateStoreCollection](Set-AzMarketplacePrivateStoreCollection.md) +Create private store collection + +### [Set-AzMarketplacePrivateStoreCollectionOffer](Set-AzMarketplacePrivateStoreCollectionOffer.md) +Update or add an offer to a specific collection of the private store. + +### [Test-AzMarketplacePrivateStoreAnyExistingOffer](Test-AzMarketplacePrivateStoreAnyExistingOffer.md) +Query whether exists any offer in the collections. + +### [Update-AzMarketplacePrivateStoreCollection](Update-AzMarketplacePrivateStoreCollection.md) +Create private store collection + +### [Update-AzMarketplacePrivateStoreCollectionOffer](Update-AzMarketplacePrivateStoreCollectionOffer.md) +Update or add an offer to a specific collection of the private store. + diff --git a/src/Marketplace/Marketplace.Autorest/help/Copy-AzMarketplacePrivateStoreCollectionOffer.md b/src/Marketplace/Marketplace.Autorest/help/Copy-AzMarketplacePrivateStoreCollectionOffer.md new file mode 100644 index 000000000000..ca94315c88e0 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Copy-AzMarketplacePrivateStoreCollectionOffer.md @@ -0,0 +1,304 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/copy-azmarketplaceprivatestorecollectionoffer +schema: 2.0.0 +--- + +# Copy-AzMarketplacePrivateStoreCollectionOffer + +## SYNOPSIS +transferring offers (copy or move) from source collection to target collection(s) + +## SYNTAX + +### TransferExpanded (Default) +``` +Copy-AzMarketplacePrivateStoreCollectionOffer -CollectionId -PrivateStoreId + [-OfferIdList ] [-Operation ] [-TargetCollection ] [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +### Transfer +``` +Copy-AzMarketplacePrivateStoreCollectionOffer -CollectionId -PrivateStoreId + -Payload [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### TransferViaIdentity +``` +Copy-AzMarketplacePrivateStoreCollectionOffer -InputObject + -Payload [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### TransferViaIdentityExpanded +``` +Copy-AzMarketplacePrivateStoreCollectionOffer -InputObject [-OfferIdList ] + [-Operation ] [-TargetCollection ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +### TransferViaIdentityPrivateStore +``` +Copy-AzMarketplacePrivateStoreCollectionOffer -CollectionId + -PrivateStoreInputObject -Payload + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### TransferViaIdentityPrivateStoreExpanded +``` +Copy-AzMarketplacePrivateStoreCollectionOffer -CollectionId + -PrivateStoreInputObject [-OfferIdList ] [-Operation ] + [-TargetCollection ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### TransferViaJsonFilePath +``` +Copy-AzMarketplacePrivateStoreCollectionOffer -CollectionId -PrivateStoreId + -JsonFilePath [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### TransferViaJsonString +``` +Copy-AzMarketplacePrivateStoreCollectionOffer -CollectionId -PrivateStoreId + -JsonString [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +transferring offers (copy or move) from source collection to target collection(s) + +## EXAMPLES + +### Example 1: Copy offers from source collection to target collections. +```powershell +$payload = @{OfferIdsList = "aumatics.azure_managedservices"; Operation = "Copy"; TargetCollection = "3ac32d8c-e888-4dc6-b4ff-be4d755af13a"} +Copy-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -Payload $payload +``` + +```output +Failed Succeeded +------ --------- +{} {DefaultCollection} +``` + +This command copy offers from source collection to target collections. + +## PARAMETERS + +### -CollectionId +The collection ID + +```yaml +Type: System.String +Parameter Sets: Transfer, TransferExpanded, TransferViaIdentityPrivateStore, TransferViaIdentityPrivateStoreExpanded, TransferViaJsonFilePath, TransferViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: TransferViaIdentity, TransferViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -JsonFilePath +Path of Json file supplied to the Transfer operation + +```yaml +Type: System.String +Parameter Sets: TransferViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Transfer operation + +```yaml +Type: System.String +Parameter Sets: TransferViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OfferIdList +Offers ids list to transfer from source collection to target collection(s) + +```yaml +Type: System.String[] +Parameter Sets: TransferExpanded, TransferViaIdentityExpanded, TransferViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Operation +Operation to perform (For example: Copy or Move) + +```yaml +Type: System.String +Parameter Sets: TransferExpanded, TransferViaIdentityExpanded, TransferViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Payload +Transfer offers properties +To construct, see NOTES section for PAYLOAD properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties +Parameter Sets: Transfer, TransferViaIdentity, TransferViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: Transfer, TransferExpanded, TransferViaJsonFilePath, TransferViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: TransferViaIdentityPrivateStore, TransferViaIdentityPrivateStoreExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -TargetCollection +Target collections ids + +```yaml +Type: System.String[] +Parameter Sets: TransferExpanded, TransferViaIdentityExpanded, TransferViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersResponse + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Disable-AzMarketplacePrivateStoreCollectionAllItem.md b/src/Marketplace/Marketplace.Autorest/help/Disable-AzMarketplacePrivateStoreCollectionAllItem.md new file mode 100644 index 000000000000..da6bfd5c4074 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Disable-AzMarketplacePrivateStoreCollectionAllItem.md @@ -0,0 +1,171 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/disable-azmarketplaceprivatestorecollectionallitem +schema: 2.0.0 +--- + +# Disable-AzMarketplacePrivateStoreCollectionAllItem + +## SYNOPSIS +Disable approve all items for the collection. + +## SYNTAX + +### Disable (Default) +``` +Disable-AzMarketplacePrivateStoreCollectionAllItem -CollectionId -PrivateStoreId + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### DisableViaIdentity +``` +Disable-AzMarketplacePrivateStoreCollectionAllItem -InputObject + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### DisableViaIdentityPrivateStore +``` +Disable-AzMarketplacePrivateStoreCollectionAllItem -CollectionId + -PrivateStoreInputObject [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Disable approve all items for the collection. + +## EXAMPLES + +### Example 1: Disable approve-all-items for a collection +```powershell +Disable-AzMarketplacePrivateStoreCollectionAllItem -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 +``` + +Disable approve all items for a collection. + +## PARAMETERS + +### -CollectionId +The collection ID + +```yaml +Type: System.String +Parameter Sets: Disable, DisableViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: DisableViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: Disable +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: DisableViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Enable-AzMarketplacePrivateStoreCollectionAllItem.md b/src/Marketplace/Marketplace.Autorest/help/Enable-AzMarketplacePrivateStoreCollectionAllItem.md new file mode 100644 index 000000000000..66af9b165cc0 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Enable-AzMarketplacePrivateStoreCollectionAllItem.md @@ -0,0 +1,171 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/enable-azmarketplaceprivatestorecollectionallitem +schema: 2.0.0 +--- + +# Enable-AzMarketplacePrivateStoreCollectionAllItem + +## SYNOPSIS +Delete all existing offers from the collection and enable approve all items. + +## SYNTAX + +### Approve (Default) +``` +Enable-AzMarketplacePrivateStoreCollectionAllItem -CollectionId -PrivateStoreId + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### ApproveViaIdentity +``` +Enable-AzMarketplacePrivateStoreCollectionAllItem -InputObject + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### ApproveViaIdentityPrivateStore +``` +Enable-AzMarketplacePrivateStoreCollectionAllItem -CollectionId + -PrivateStoreInputObject [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Delete all existing offers from the collection and enable approve all items. + +## EXAMPLES + +### Example 1: Enable approve-all-items for a collection +```powershell +Enable-AzMarketplacePrivateStoreCollectionAllItem -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 +``` + +Delete all existing offers from the collection and enable approve all items. + +## PARAMETERS + +### -CollectionId +The collection ID + +```yaml +Type: System.String +Parameter Sets: Approve, ApproveViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: ApproveViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: Approve +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: ApproveViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplaceBillingPrivateStoreAccount.md b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplaceBillingPrivateStoreAccount.md new file mode 100644 index 000000000000..4929347ca058 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplaceBillingPrivateStoreAccount.md @@ -0,0 +1,137 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplacebillingprivatestoreaccount +schema: 2.0.0 +--- + +# Get-AzMarketplaceBillingPrivateStoreAccount + +## SYNOPSIS +Tenant billing accounts names + +## SYNTAX + +### Billing (Default) +``` +Get-AzMarketplaceBillingPrivateStoreAccount -PrivateStoreId [-DefaultProfile ] [-Confirm] + [-WhatIf] [] +``` + +### BillingViaIdentity +``` +Get-AzMarketplaceBillingPrivateStoreAccount -InputObject [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Tenant billing accounts names + +## EXAMPLES + +### Example 1: Returns the billing account of a private store +```powershell +Get-AzMarketplaceBillingPrivateStoreAccount -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a +``` + +```output + +``` + +This command returns the billing account of a private store. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: BillingViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: Billing +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBillingAccountsResponse + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplaceCollectionToSubscriptionMapping.md b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplaceCollectionToSubscriptionMapping.md new file mode 100644 index 000000000000..d5f8e26697fa --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplaceCollectionToSubscriptionMapping.md @@ -0,0 +1,228 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplacecollectiontosubscriptionmapping +schema: 2.0.0 +--- + +# Get-AzMarketplaceCollectionToSubscriptionMapping + +## SYNOPSIS +For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied list. + +## SYNTAX + +### CollectionsExpanded (Default) +``` +Get-AzMarketplaceCollectionToSubscriptionMapping -PrivateStoreId [-SubscriptionId ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### Collections +``` +Get-AzMarketplaceCollectionToSubscriptionMapping -PrivateStoreId + -Payload [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +### CollectionsViaIdentity +``` +Get-AzMarketplaceCollectionToSubscriptionMapping -InputObject + -Payload [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +### CollectionsViaIdentityExpanded +``` +Get-AzMarketplaceCollectionToSubscriptionMapping -InputObject + [-SubscriptionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### CollectionsViaJsonFilePath +``` +Get-AzMarketplaceCollectionToSubscriptionMapping -PrivateStoreId -JsonFilePath + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### CollectionsViaJsonString +``` +Get-AzMarketplaceCollectionToSubscriptionMapping -PrivateStoreId -JsonString + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied list. + +## EXAMPLES + +### Example 1: Map subscriptions to collections +```powershell +$res = Get-AzMarketplaceCollectionToSubscriptionMapping -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -Payload @{SubscriptionId = "53425a7b-4ac1-4729-8340-e1da5046212c"} +$res.keys +``` + +```output +e58535dc-1be3-4d2c-904c-1f97984ebe5d +fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 +``` + +This command For a given subscriptions list, will return a map of collections and the related subscriptions from the supplied list. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: CollectionsViaIdentity, CollectionsViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -JsonFilePath +Path of Json file supplied to the Collections operation + +```yaml +Type: System.String +Parameter Sets: CollectionsViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Collections operation + +```yaml +Type: System.String +Parameter Sets: CollectionsViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Payload +The subscriptions list to get the related collections +To construct, see NOTES section for PAYLOAD properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload +Parameter Sets: Collections, CollectionsViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: Collections, CollectionsExpanded, CollectionsViaJsonFilePath, CollectionsViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Subscriptions ids list + +```yaml +Type: System.String[] +Parameter Sets: CollectionsExpanded, CollectionsViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingResponse + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.md b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.md new file mode 100644 index 000000000000..9e64baf20f69 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.md @@ -0,0 +1,148 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreallsubscriptionintenant +schema: 2.0.0 +--- + +# Get-AzMarketplacePrivateStoreAllSubscriptionInTenant + +## SYNOPSIS +Fetch all subscriptions in tenant, only for marketplace admin + +## SYNTAX + +### Fetch (Default) +``` +Get-AzMarketplacePrivateStoreAllSubscriptionInTenant -PrivateStoreId [-NextPageToken ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### FetchViaIdentity +``` +Get-AzMarketplacePrivateStoreAllSubscriptionInTenant -InputObject + [-NextPageToken ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Fetch all subscriptions in tenant, only for marketplace admin + +## EXAMPLES + +### Example 1: Fetch all subscriptions in a tenant +```powershell +Get-AzMarketplacePrivateStoreAllSubscriptionInTenant -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 +``` + +Fetch all subscriptions in tenant, only for marketplace admin. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: FetchViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NextPageToken +The skip token to get the next page. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: Fetch +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreCollection.md b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreCollection.md new file mode 100644 index 000000000000..701afb8098ef --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreCollection.md @@ -0,0 +1,155 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollection +schema: 2.0.0 +--- + +# Get-AzMarketplacePrivateStoreCollection + +## SYNOPSIS +Gets private store collection + +## SYNTAX + +### List (Default) +``` +Get-AzMarketplacePrivateStoreCollection -PrivateStoreId [-DefaultProfile ] + [] +``` + +### Get +``` +Get-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreId + [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzMarketplacePrivateStoreCollection -InputObject [-DefaultProfile ] + [] +``` + +### GetViaIdentityPrivateStore +``` +Get-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreInputObject + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets private store collection + +## EXAMPLES + +### Example 1: Get list of private store collections +```powershell +Get-AzMarketplacePrivateStoreCollection -PrivateStoreId 53425a7b-4ac1-4729-8340-e1da5046212c +``` + +```output +Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType +---- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- +53425a7b-4ac1-4729-8340-e1da5046212c User 8/23/2021 6:06:52 AM User +23455a7b-4ac1-4729-8340-e1da5046212c 12/1/2021 9:01:33 PM User 12/1/2021 9:01:33 PM User + +``` + +This command gets list of private store collections. + +## PARAMETERS + +### -CollectionId +The collection ID + +```yaml +Type: System.String +Parameter Sets: Get, GetViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: GetViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsList + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.md b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.md new file mode 100644 index 000000000000..f5c6fab6255a --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.md @@ -0,0 +1,138 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollectionmapofferstocontext +schema: 2.0.0 +--- + +# Get-AzMarketplacePrivateStoreCollectionMapOffersToContext + +## SYNOPSIS +Get a list of all offers in the given collection according to the required contexts. + +## SYNTAX + +``` +Get-AzMarketplacePrivateStoreCollectionMapOffersToContext -CollectionId -PrivateStoreId + [-SubscriptionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Get a list of all offers in the given collection according to the required contexts. + +## EXAMPLES + +### Example 1: Map offers to subscriptions +```powershell +Get-AzMarketplacePrivateStoreCollectionMapOffersToContext -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionId 1f58b5dd-313c-42ed-84fc-f1e351bba7fb,ab3de7bc-7a6e-4e9f-a34a-f6922df453e4 +``` + +Get a list of all offers in the given collection according to the required subscriptions. + +## PARAMETERS + +### -CollectionId +The collection ID + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Subscription ids list + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContext + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreCollectionOffer.md b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreCollectionOffer.md new file mode 100644 index 000000000000..a4d020f7e159 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreCollectionOffer.md @@ -0,0 +1,190 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollectionoffer +schema: 2.0.0 +--- + +# Get-AzMarketplacePrivateStoreCollectionOffer + +## SYNOPSIS +Gets information about a specific offer. + +## SYNTAX + +### List (Default) +``` +Get-AzMarketplacePrivateStoreCollectionOffer -CollectionId -PrivateStoreId + [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId -PrivateStoreId + [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzMarketplacePrivateStoreCollectionOffer -InputObject [-DefaultProfile ] + [] +``` + +### GetViaIdentityCollection +``` +Get-AzMarketplacePrivateStoreCollectionOffer -CollectionInputObject -OfferId + [-DefaultProfile ] [] +``` + +### GetViaIdentityPrivateStore +``` +Get-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId + -PrivateStoreInputObject [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets information about a specific offer. + +## EXAMPLES + +### Example 1: Gets collection offers +```powershell +Get-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 +``` + +```output +Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType +---- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ------------------- +data3-limited-1019419.d3_azure_managed_services +viacode_consulting-1089577.viacodems +RedHat.RHEL_7 +``` + +This command get collection offers. + +## PARAMETERS + +### -CollectionId +The collection ID + +```yaml +Type: System.String +Parameter Sets: Get, GetViaIdentityPrivateStore, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CollectionInputObject +Identity Parameter +To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: GetViaIdentityCollection +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -OfferId +The offer ID to update or delete + +```yaml +Type: System.String +Parameter Sets: Get, GetViaIdentityCollection, GetViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: GetViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreCollectionRule.md b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreCollectionRule.md new file mode 100644 index 000000000000..142ae1a53108 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreCollectionRule.md @@ -0,0 +1,171 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollectionrule +schema: 2.0.0 +--- + +# Get-AzMarketplacePrivateStoreCollectionRule + +## SYNOPSIS +Get a list of all private store rules in the given private store and collection + +## SYNTAX + +### Query (Default) +``` +Get-AzMarketplacePrivateStoreCollectionRule -CollectionId -PrivateStoreId + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### QueryViaIdentity +``` +Get-AzMarketplacePrivateStoreCollectionRule -InputObject [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +### QueryViaIdentityPrivateStore +``` +Get-AzMarketplacePrivateStoreCollectionRule -CollectionId + -PrivateStoreInputObject [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Get a list of all private store rules in the given private store and collection + +## EXAMPLES + +### Example 1: Get applied rules on a collection +```powershell +Get-AzMarketplacePrivateStoreCollectionRule -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 +``` + +Get a list of all private store rules in the given private store and collection. + +## PARAMETERS + +### -CollectionId +The collection ID + +```yaml +Type: System.String +Parameter Sets: Query, QueryViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: QueryViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: Query +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: QueryViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreNewPlanNotification.md b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreNewPlanNotification.md new file mode 100644 index 000000000000..6a73d229ebf6 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreNewPlanNotification.md @@ -0,0 +1,108 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorenewplannotification +schema: 2.0.0 +--- + +# Get-AzMarketplacePrivateStoreNewPlanNotification + +## SYNOPSIS +List new plans notifications + +## SYNTAX + +``` +Get-AzMarketplacePrivateStoreNewPlanNotification -PrivateStoreId [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +List new plans notifications + +## EXAMPLES + +### Example 1: List new plans notifications +```powershell +Get-AzMarketplacePrivateStoreNewPlanNotification -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 +``` + +List new plans notifications. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsList + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreSubscription.md b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreSubscription.md new file mode 100644 index 000000000000..8b4c4b6d5a79 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreSubscription.md @@ -0,0 +1,108 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoresubscription +schema: 2.0.0 +--- + +# Get-AzMarketplacePrivateStoreSubscription + +## SYNOPSIS +List all the subscriptions in the private store context + +## SYNTAX + +``` +Get-AzMarketplacePrivateStoreSubscription -PrivateStoreId [-DefaultProfile ] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +List all the subscriptions in the private store context + +## EXAMPLES + +### Example 1: List all subscriptions +```powershell +Get-AzMarketplacePrivateStoreSubscription -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 +``` + +List all subscriptions in the private store context. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextList + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreUserOffer.md b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreUserOffer.md new file mode 100644 index 000000000000..2b2f82f27f6e --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreUserOffer.md @@ -0,0 +1,163 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreuseroffer +schema: 2.0.0 +--- + +# Get-AzMarketplacePrivateStoreUserOffer + +## SYNOPSIS +List of user's approved offers for the provided offers and subscriptions + +## SYNTAX + +### QueryExpanded (Default) +``` +Get-AzMarketplacePrivateStoreUserOffer -PrivateStoreId [-OfferId ] + [-SubscriptionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### QueryViaIdentityExpanded +``` +Get-AzMarketplacePrivateStoreUserOffer -InputObject [-OfferId ] + [-SubscriptionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +List of user's approved offers for the provided offers and subscriptions + +## EXAMPLES + +### Example 1: List all approved offers for a user +```powershell +Get-AzMarketplacePrivateStoreUserOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -OfferId aumatics.azure_managedservices -SubscriptionId 1f58b5dd-313c-42ed-84fc-f1e351bba7fb +``` + +List of user's approved offers for the provided offers and subscriptions. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: QueryViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -OfferId +List of offer IDs + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: QueryExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +List of subscription IDs + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreUserRule.md b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreUserRule.md new file mode 100644 index 000000000000..b1c968b75c97 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreUserRule.md @@ -0,0 +1,148 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreuserrule +schema: 2.0.0 +--- + +# Get-AzMarketplacePrivateStoreUserRule + +## SYNOPSIS +All rules approved in the private store that are relevant for user subscriptions + +## SYNTAX + +### QueryExpanded (Default) +``` +Get-AzMarketplacePrivateStoreUserRule -PrivateStoreId [-SubscriptionId ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### QueryViaIdentityExpanded +``` +Get-AzMarketplacePrivateStoreUserRule -InputObject [-SubscriptionId ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +All rules approved in the private store that are relevant for user subscriptions + +## EXAMPLES + +### Example 1: Get all applied rules for user subscriptions +```powershell +Get-AzMarketplacePrivateStoreUserRule -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionId 1f58b5dd-313c-42ed-84fc-f1e351bba7fb +``` + +All rules approved in the private store that are relevant for user subscriptions. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: QueryViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: QueryExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +List of subscription IDs + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreV1.md b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreV1.md new file mode 100644 index 000000000000..edfe692cc2a6 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplacePrivateStoreV1.md @@ -0,0 +1,127 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorev1 +schema: 2.0.0 +--- + +# Get-AzMarketplacePrivateStoreV1 + +## SYNOPSIS +Get information about the private store + +## SYNTAX + +### List (Default) +``` +Get-AzMarketplacePrivateStoreV1 [-UseCache ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzMarketplacePrivateStoreV1 -Id [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzMarketplacePrivateStoreV1 -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Get information about the private store + +## EXAMPLES + +### Example 1: Get Private Store details +```powershell +Get-AzMarketplacePrivateStoreV1 +``` + +```output +Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType +---- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- +a260d38c-96cf-492d-a340-404d0c4b3ad6 User 12/1/2021 9:01:33 PM User +``` + +This command Gets the private store details + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Id +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: PrivateStoreId + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -UseCache +Determines if to use cache or DB for serving this request + +```yaml +Type: System.String +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplaceQueryPrivateStoreOffer.md b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplaceQueryPrivateStoreOffer.md new file mode 100644 index 000000000000..4742cdf2808b --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Get-AzMarketplaceQueryPrivateStoreOffer.md @@ -0,0 +1,144 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplacequeryprivatestoreoffer +schema: 2.0.0 +--- + +# Get-AzMarketplaceQueryPrivateStoreOffer + +## SYNOPSIS +List of offers, regardless the collections + +## SYNTAX + +### Query (Default) +``` +Get-AzMarketplaceQueryPrivateStoreOffer -PrivateStoreId [-DefaultProfile ] [-Confirm] + [-WhatIf] [] +``` + +### QueryViaIdentity +``` +Get-AzMarketplaceQueryPrivateStoreOffer -InputObject [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +List of offers, regardless the collections + +## EXAMPLES + +### Example 1: Returns private store offer regardless of collections +```powershell +Get-AzMarketplaceQueryPrivateStoreOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a +``` + +```output +CreatedAt ETag ModifiedAt OfferDisplayName PrivateStoreId PublisherDisplayName SpecificPlanIdLimitation UniqueOfferId +--------- ---- ---------- ---------------- -------------- -------------------- ------------------------- ------------- + "ed0093ae-0000-0100-0000-61a4dab30000" 3ac32d8c-e888-4dc6-b4ff-be4d755af13a {d3-azure-health-check, data3-azure-optimiser-plan, data3-managed-azure-plan} data3-limite… + "750547d8-0000-0100-0000-61b752010000" 3ac32d8c-e888-4dc6-b4ff-be4d755af13a {mgmt-limited-free, mgmt-assessment} viacode_cons… + "ef00ab05-0000-0100-0000-61a5f12f0000" 3ac32d8c-e888-4dc6-b4ff-be4d755af13a {RedHatEnterpriseLinux72-ARM} RedHat.RHEL_7 + "f300276b-0000-0100-0000-61a7e1af0000" 3ac32d8c-e888-4dc6-b4ff-be4d755af13a {128technology_conductor_hourly_427, 128technology_conductor_hourly_452} 128technolog… + "f300296b-0000-0100-0000-61a7e1af0000" 3ac32d8c-e888-4dc6-b4ff-be4d755af13a {128technology_router_100_hourly_427, 128technology_router_100_hourly_452} 128technolog… + +``` + +This command returns private store offer regardless of collections + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: QueryViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: Query +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/New-AzMarketplacePrivateStore.md b/src/Marketplace/Marketplace.Autorest/help/New-AzMarketplacePrivateStore.md new file mode 100644 index 000000000000..9fd941cc43c0 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/New-AzMarketplacePrivateStore.md @@ -0,0 +1,289 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestore +schema: 2.0.0 +--- + +# New-AzMarketplacePrivateStore + +## SYNOPSIS +Changes private store properties + +## SYNTAX + +### CreateExpanded (Default) +``` +New-AzMarketplacePrivateStore -Id [-Availability ] [-Branding ] [-ETag ] + [-IsGov] [-NotificationSettingRecipient ] [-NotificationSettingSendToAllMarketplaceAdmin] + [-PrivateStoreName ] [-TenantId ] [-DefaultProfile ] [-PassThru] [-Confirm] + [-WhatIf] [] +``` + +### CreateViaJsonFilePath +``` +New-AzMarketplacePrivateStore -Id -JsonFilePath [-DefaultProfile ] [-PassThru] + [-Confirm] [-WhatIf] [] +``` + +### CreateViaJsonString +``` +New-AzMarketplacePrivateStore -Id -JsonString [-DefaultProfile ] [-PassThru] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Changes private store properties + +## EXAMPLES + +### Example 1: Changes private store properties +```powershell +New-AzMarketplacePrivateStore -Id 0000000-0000-00000-0000-000000000000 -Availability 'disabled' -ETag '0000000-0000-00000-0000-000000000000' +``` + +This command changes private store properties. + +## PARAMETERS + +### -Availability +Indicates private store availability + +```yaml +Type: System.String +Parameter Sets: CreateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Branding +Gets or sets list of branding characteristics + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: CreateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ETag +Identifier for purposes of race condition + +```yaml +Type: System.String +Parameter Sets: CreateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Id +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: PrivateStoreId + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IsGov +Is government + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: CreateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonFilePath +Path of Json file supplied to the Create operation + +```yaml +Type: System.String +Parameter Sets: CreateViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Create operation + +```yaml +Type: System.String +Parameter Sets: CreateViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NotificationSettingRecipient +Gets or sets list of notified recipients for new requests +To construct, see NOTES section for NOTIFICATIONSETTINGRECIPIENT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient[] +Parameter Sets: CreateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NotificationSettingSendToAllMarketplaceAdmin +Gets or sets whether to send email to all marketplace admins for new requests + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: CreateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreName +Private Store Name + +```yaml +Type: System.String +Parameter Sets: CreateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TenantId +Tenant id + +```yaml +Type: System.String +Parameter Sets: CreateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/New-AzMarketplacePrivateStoreCollection.md b/src/Marketplace/Marketplace.Autorest/help/New-AzMarketplacePrivateStoreCollection.md new file mode 100644 index 000000000000..256428b46644 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/New-AzMarketplacePrivateStoreCollection.md @@ -0,0 +1,299 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollection +schema: 2.0.0 +--- + +# New-AzMarketplacePrivateStoreCollection + +## SYNOPSIS +Create private store collection + +## SYNTAX + +### CreateExpanded (Default) +``` +New-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreId [-AllSubscription] + [-Claim ] [-CollectionName ] [-Enabled] [-SubscriptionsList ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### CreateViaIdentityPrivateStore +``` +New-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreInputObject + -Payload [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### CreateViaIdentityPrivateStoreExpanded +``` +New-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreInputObject + [-AllSubscription] [-Claim ] [-CollectionName ] [-Enabled] [-SubscriptionsList ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### CreateViaJsonFilePath +``` +New-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreId -JsonFilePath + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### CreateViaJsonString +``` +New-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreId -JsonString + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Create private store collection + +## EXAMPLES + +### Example 1: Create or updates private store collection +```powershell +New-AzMarketplacePrivateStoreCollection -CollectionName test -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -SubscriptionsList 7f5402e4-e8f4-46bd-9bd1-8d27866a606b +``` + +```output +Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType +---- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- +fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 12/13/2021 11:12:27 AM User 12/13/2021 11:12:27 AM User +``` + +This command create or updates private store collection + +## PARAMETERS + +### -AllSubscription +Indicating whether all subscriptions are selected (=true) or not (=false). + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: CreateExpanded, CreateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Claim +Gets or sets the association with Commercial's Billing Account. + +```yaml +Type: System.String +Parameter Sets: CreateExpanded, CreateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CollectionId +The collection ID + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CollectionName +Gets or sets collection name. + +```yaml +Type: System.String +Parameter Sets: CreateExpanded, CreateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Enabled +Indicating whether the collection is enabled or disabled. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: CreateExpanded, CreateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonFilePath +Path of Json file supplied to the Create operation + +```yaml +Type: System.String +Parameter Sets: CreateViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Create operation + +```yaml +Type: System.String +Parameter Sets: CreateViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Payload +The Collection data structure. +To construct, see NOTES section for PAYLOAD properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection +Parameter Sets: CreateViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: CreateExpanded, CreateViaJsonFilePath, CreateViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: CreateViaIdentityPrivateStore, CreateViaIdentityPrivateStoreExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -SubscriptionsList +Gets or sets subscription ids list. +Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. +On insert, null is considered as bad request + +```yaml +Type: System.String[] +Parameter Sets: CreateExpanded, CreateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/New-AzMarketplacePrivateStoreCollectionOffer.md b/src/Marketplace/Marketplace.Autorest/help/New-AzMarketplacePrivateStoreCollectionOffer.md new file mode 100644 index 000000000000..7eb5bed063b8 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/New-AzMarketplacePrivateStoreCollectionOffer.md @@ -0,0 +1,346 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollectionoffer +schema: 2.0.0 +--- + +# New-AzMarketplacePrivateStoreCollectionOffer + +## SYNOPSIS +Update or add an offer to a specific collection of the private store. + +## SYNTAX + +### CreateExpanded (Default) +``` +New-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId -PrivateStoreId + [-ETag ] [-IconFileUri ] [-Plan ] [-SpecificPlanIdLimitation ] + [-UpdateSuppressedDueIdempotence] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### CreateViaIdentityCollection +``` +New-AzMarketplacePrivateStoreCollectionOffer -CollectionInputObject -OfferId + -Payload [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### CreateViaIdentityCollectionExpanded +``` +New-AzMarketplacePrivateStoreCollectionOffer -CollectionInputObject -OfferId + [-ETag ] [-IconFileUri ] [-Plan ] [-SpecificPlanIdLimitation ] + [-UpdateSuppressedDueIdempotence] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### CreateViaIdentityPrivateStore +``` +New-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId + -PrivateStoreInputObject -Payload [-DefaultProfile ] [-Confirm] + [-WhatIf] [] +``` + +### CreateViaIdentityPrivateStoreExpanded +``` +New-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId + -PrivateStoreInputObject [-ETag ] [-IconFileUri ] [-Plan ] + [-SpecificPlanIdLimitation ] [-UpdateSuppressedDueIdempotence] [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +### CreateViaJsonFilePath +``` +New-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId -PrivateStoreId + -JsonFilePath [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### CreateViaJsonString +``` +New-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId -PrivateStoreId + -JsonString [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Update or add an offer to a specific collection of the private store. + +## EXAMPLES + +### Example 1: Creates or updates offer to private store collection +```powershell +$acc = @{Accessibility = "azure_managedservices_professional"} +New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -OfferId aumatics.azure_managedservices -Plan $acc +``` + +```output +Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType +---- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- +aumatics.azure_managedservices +``` + +This command creates or updates offer to private store collection. + +## PARAMETERS + +### -CollectionId +The collection ID + +```yaml +Type: System.String +Parameter Sets: CreateExpanded, CreateViaIdentityPrivateStore, CreateViaIdentityPrivateStoreExpanded, CreateViaJsonFilePath, CreateViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CollectionInputObject +Identity Parameter +To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: CreateViaIdentityCollection, CreateViaIdentityCollectionExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ETag +Identifier for purposes of race condition + +```yaml +Type: System.String +Parameter Sets: CreateExpanded, CreateViaIdentityCollectionExpanded, CreateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IconFileUri +Icon File Uris + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: CreateExpanded, CreateViaIdentityCollectionExpanded, CreateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonFilePath +Path of Json file supplied to the Create operation + +```yaml +Type: System.String +Parameter Sets: CreateViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Create operation + +```yaml +Type: System.String +Parameter Sets: CreateViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OfferId +The offer ID to update or delete + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Payload +The privateStore offer data structure. +To construct, see NOTES section for PAYLOAD properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer +Parameter Sets: CreateViaIdentityCollection, CreateViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Plan +Offer plans +To construct, see NOTES section for PLAN properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[] +Parameter Sets: CreateExpanded, CreateViaIdentityCollectionExpanded, CreateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: CreateExpanded, CreateViaJsonFilePath, CreateViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: CreateViaIdentityPrivateStore, CreateViaIdentityPrivateStoreExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -SpecificPlanIdLimitation +Plan ids limitation for this offer + +```yaml +Type: System.String[] +Parameter Sets: CreateExpanded, CreateViaIdentityCollectionExpanded, CreateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UpdateSuppressedDueIdempotence +Indicating whether the offer was not updated to db (true = not updated). +If the allow list is identical to the existed one in db, the offer would not be updated. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: CreateExpanded, CreateViaIdentityCollectionExpanded, CreateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/New-AzMarketplacePrivateStoreCollectionOfferMultiContext.md b/src/Marketplace/Marketplace.Autorest/help/New-AzMarketplacePrivateStoreCollectionOfferMultiContext.md new file mode 100644 index 000000000000..e5174e7303b2 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/New-AzMarketplacePrivateStoreCollectionOfferMultiContext.md @@ -0,0 +1,269 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollectionoffermulticontext +schema: 2.0.0 +--- + +# New-AzMarketplacePrivateStoreCollectionOfferMultiContext + +## SYNOPSIS +Upsert an offer with multiple context details. + +## SYNTAX + +### OfferExpanded (Default) +``` +New-AzMarketplacePrivateStoreCollectionOfferMultiContext -CollectionId -OfferId + -PrivateStoreId [-ETag ] [-PlansContext ] + [-PropertiesOfferId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### OfferViaIdentityCollectionExpanded +``` +New-AzMarketplacePrivateStoreCollectionOfferMultiContext -CollectionInputObject + -OfferId [-ETag ] [-PlansContext ] [-PropertiesOfferId ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### OfferViaIdentityExpanded +``` +New-AzMarketplacePrivateStoreCollectionOfferMultiContext -InputObject + [-OfferId ] [-ETag ] [-PlansContext ] [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +### OfferViaIdentityPrivateStoreExpanded +``` +New-AzMarketplacePrivateStoreCollectionOfferMultiContext -CollectionId -OfferId + -PrivateStoreInputObject [-ETag ] [-PlansContext ] + [-PropertiesOfferId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Upsert an offer with multiple context details. + +## EXAMPLES + +### Example 1: Upsert an offer with multiple contexts +```powershell +$plan1 = @{ + context = "1f58b5dd-313c-42ed-84fc-f1e351bba7fb" + planId = "plan1" +} + +$plan2 = @{ + context = "ab3de7bc-7a6e-4e9f-a34a-f6922df453e4" + planId = "plan2" +} + +$plans = @($plan1,$plan2) + +New-AzMarketplacePrivateStoreCollectionOfferMultiContext -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -OfferId test_pmc2pc1.vm_4plans -PlansContext $plans +``` + +Upsert an offer with multiple context details. + +## PARAMETERS + +### -CollectionId +The collection ID + +```yaml +Type: System.String +Parameter Sets: OfferExpanded, OfferViaIdentityPrivateStoreExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CollectionInputObject +Identity Parameter +To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: OfferViaIdentityCollectionExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ETag +The offer's eTag. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: OfferViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -OfferId +The offer ID to update or delete + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PlansContext +. +To construct, see NOTES section for PLANSCONTEXT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IContextAndPlansDetails[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: OfferExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: OfferViaIdentityPrivateStoreExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PropertiesOfferId +The offer ID which contains the plans. + +```yaml +Type: System.String +Parameter Sets: OfferExpanded, OfferViaIdentityCollectionExpanded, OfferViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/README.md b/src/Marketplace/Marketplace.Autorest/help/README.md new file mode 100644 index 000000000000..ac709929b514 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/README.md @@ -0,0 +1,11 @@ +# Docs +This directory contains the documentation of the cmdlets for the `Az.Marketplace` 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 +- Generated: all +- Committed: yes +- Packaged: yes + +## Details +The process of documentation generation loads `Az.Marketplace` 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. \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/help/Remove-AzMarketplacePrivateStoreCollection.md b/src/Marketplace/Marketplace.Autorest/help/Remove-AzMarketplacePrivateStoreCollection.md new file mode 100644 index 000000000000..5b42823623be --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Remove-AzMarketplacePrivateStoreCollection.md @@ -0,0 +1,186 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/remove-azmarketplaceprivatestorecollection +schema: 2.0.0 +--- + +# Remove-AzMarketplacePrivateStoreCollection + +## SYNOPSIS +Delete a collection from the given private store. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreId + [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzMarketplacePrivateStoreCollection -InputObject [-DefaultProfile ] + [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentityPrivateStore +``` +Remove-AzMarketplacePrivateStoreCollection -CollectionId + -PrivateStoreInputObject [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Delete a collection from the given private store. + +## EXAMPLES + +### Example 1: Removes private store collection +```powershell +Remove-AzMarketplacePrivateStoreCollection -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 +``` + +This command removes private store collection + +## PARAMETERS + +### -CollectionId +The collection ID + +```yaml +Type: System.String +Parameter Sets: Delete, DeleteViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: DeleteViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Remove-AzMarketplacePrivateStoreCollectionOffer.md b/src/Marketplace/Marketplace.Autorest/help/Remove-AzMarketplacePrivateStoreCollectionOffer.md new file mode 100644 index 000000000000..5192c5bc3ebe --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Remove-AzMarketplacePrivateStoreCollectionOffer.md @@ -0,0 +1,223 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/remove-azmarketplaceprivatestorecollectionoffer +schema: 2.0.0 +--- + +# Remove-AzMarketplacePrivateStoreCollectionOffer + +## SYNOPSIS +Deletes an offer from the given collection of private store. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId + -PrivateStoreId [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzMarketplacePrivateStoreCollectionOffer -InputObject + [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentityCollection +``` +Remove-AzMarketplacePrivateStoreCollectionOffer -CollectionInputObject + -OfferId [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentityPrivateStore +``` +Remove-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId + -PrivateStoreInputObject [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Deletes an offer from the given collection of private store. + +## EXAMPLES + +### Example 1: Removes offer from private store collection +```powershell +Remove-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -OfferId aumatics.azure_managedservices +``` + +This command removes offer from private store collection + +## PARAMETERS + +### -CollectionId +The collection ID + +```yaml +Type: System.String +Parameter Sets: Delete, DeleteViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CollectionInputObject +Identity Parameter +To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: DeleteViaIdentityCollection +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -OfferId +The offer ID to update or delete + +```yaml +Type: System.String +Parameter Sets: Delete, DeleteViaIdentityCollection, DeleteViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: DeleteViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Set-AzMarketplaceBulkPrivateStoreCollectionAction.md b/src/Marketplace/Marketplace.Autorest/help/Set-AzMarketplaceBulkPrivateStoreCollectionAction.md new file mode 100644 index 000000000000..390e3a44b772 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Set-AzMarketplaceBulkPrivateStoreCollectionAction.md @@ -0,0 +1,211 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/set-azmarketplacebulkprivatestorecollectionaction +schema: 2.0.0 +--- + +# Set-AzMarketplaceBulkPrivateStoreCollectionAction + +## SYNOPSIS +Perform an action on bulk collections + +## SYNTAX + +### BulkExpanded (Default) +``` +Set-AzMarketplaceBulkPrivateStoreCollectionAction -PrivateStoreId [-Action ] + [-CollectionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### Bulk +``` +Set-AzMarketplaceBulkPrivateStoreCollectionAction -PrivateStoreId -Payload + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### BulkViaJsonFilePath +``` +Set-AzMarketplaceBulkPrivateStoreCollectionAction -PrivateStoreId -JsonFilePath + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### BulkViaJsonString +``` +Set-AzMarketplaceBulkPrivateStoreCollectionAction -PrivateStoreId -JsonString + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Perform an action on bulk collections + +## EXAMPLES + +### Example 1: Preforms bulk action on collections +```powershell +Set-AzMarketplaceBulkPrivateStoreCollectionAction -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -Payload @{Action = "EnableCollections"; CollectionId = "3ac32d8c-e888-4dc6-b4ff-be4d755af13a", "fdb889a1-cf3e-49f0-95b8-2bb012fa01f1" } +``` + +```output +Failed Succeeded +------ --------- +{} {DefaultCollection, test} +``` + +This command Preforms bulk action on collections + +## PARAMETERS + +### -Action +Action to perform (For example: EnableCollections, DisableCollections) + +```yaml +Type: System.String +Parameter Sets: BulkExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CollectionId +collection ids list that the action is performed on + +```yaml +Type: System.String[] +Parameter Sets: BulkExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonFilePath +Path of Json file supplied to the Bulk operation + +```yaml +Type: System.String +Parameter Sets: BulkViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Bulk operation + +```yaml +Type: System.String +Parameter Sets: BulkViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Payload +Bulk collections action properties +To construct, see NOTES section for PAYLOAD properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload +Parameter Sets: Bulk +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsResponse + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Set-AzMarketplacePrivateStore.md b/src/Marketplace/Marketplace.Autorest/help/Set-AzMarketplacePrivateStore.md new file mode 100644 index 000000000000..8ed6173cc115 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Set-AzMarketplacePrivateStore.md @@ -0,0 +1,289 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/set-azmarketplaceprivatestore +schema: 2.0.0 +--- + +# Set-AzMarketplacePrivateStore + +## SYNOPSIS +Changes private store properties + +## SYNTAX + +### UpdateExpanded (Default) +``` +Set-AzMarketplacePrivateStore -Id [-Availability ] [-Branding ] [-ETag ] + [-IsGov] [-NotificationSettingRecipient ] [-NotificationSettingSendToAllMarketplaceAdmin] + [-PrivateStoreName ] [-TenantId ] [-DefaultProfile ] [-PassThru] [-Confirm] + [-WhatIf] [] +``` + +### UpdateViaJsonFilePath +``` +Set-AzMarketplacePrivateStore -Id -JsonFilePath [-DefaultProfile ] [-PassThru] + [-Confirm] [-WhatIf] [] +``` + +### UpdateViaJsonString +``` +Set-AzMarketplacePrivateStore -Id -JsonString [-DefaultProfile ] [-PassThru] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Changes private store properties + +## EXAMPLES + +### Example 1: Changes private store properties +```powershell +Set-AzMarketplacePrivateStore -Id 0000000-0000-00000-0000-000000000000 -Availability 'disabled' -ETag '0000000-0000-00000-0000-000000000000' +``` + +This command changes private store properties + +## PARAMETERS + +### -Availability +Indicates private store availability + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Branding +Gets or sets list of branding characteristics + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ETag +Identifier for purposes of race condition + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Id +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: PrivateStoreId + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IsGov +Is government + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonFilePath +Path of Json file supplied to the Update operation + +```yaml +Type: System.String +Parameter Sets: UpdateViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Update operation + +```yaml +Type: System.String +Parameter Sets: UpdateViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NotificationSettingRecipient +Gets or sets list of notified recipients for new requests +To construct, see NOTES section for NOTIFICATIONSETTINGRECIPIENT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient[] +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NotificationSettingSendToAllMarketplaceAdmin +Gets or sets whether to send email to all marketplace admins for new requests + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreName +Private Store Name + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TenantId +Tenant id + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Set-AzMarketplacePrivateStoreCollection.md b/src/Marketplace/Marketplace.Autorest/help/Set-AzMarketplacePrivateStoreCollection.md new file mode 100644 index 000000000000..ef2370c92486 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Set-AzMarketplacePrivateStoreCollection.md @@ -0,0 +1,250 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/set-azmarketplaceprivatestorecollection +schema: 2.0.0 +--- + +# Set-AzMarketplacePrivateStoreCollection + +## SYNOPSIS +Create private store collection + +## SYNTAX + +### UpdateExpanded (Default) +``` +Set-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreId [-AllSubscription] + [-Claim ] [-CollectionName ] [-Enabled] [-SubscriptionsList ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaJsonFilePath +``` +Set-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreId -JsonFilePath + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaJsonString +``` +Set-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreId -JsonString + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Create private store collection + +## EXAMPLES + +### Example 1: Creates or updates private store collection +```powershell +Set-AzMarketplacePrivateStoreCollection -CollectionId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -AllSubscription +``` + +```output +Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType +---- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- +7f5402e4-e8f4-46bd-9bd1-8d27866a606b User 12/13/2021 1:21:57 PM User +``` + +This command creates or updates private store collection + +## PARAMETERS + +### -AllSubscription +Indicating whether all subscriptions are selected (=true) or not (=false). + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Claim +Gets or sets the association with Commercial's Billing Account. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CollectionId +The collection ID + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CollectionName +Gets or sets collection name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Enabled +Indicating whether the collection is enabled or disabled. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonFilePath +Path of Json file supplied to the Update operation + +```yaml +Type: System.String +Parameter Sets: UpdateViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Update operation + +```yaml +Type: System.String +Parameter Sets: UpdateViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionsList +Gets or sets subscription ids list. +Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. +On insert, null is considered as bad request + +```yaml +Type: System.String[] +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Set-AzMarketplacePrivateStoreCollectionOffer.md b/src/Marketplace/Marketplace.Autorest/help/Set-AzMarketplacePrivateStoreCollectionOffer.md new file mode 100644 index 000000000000..c7829d6ca959 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Set-AzMarketplacePrivateStoreCollectionOffer.md @@ -0,0 +1,266 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/set-azmarketplaceprivatestorecollectionoffer +schema: 2.0.0 +--- + +# Set-AzMarketplacePrivateStoreCollectionOffer + +## SYNOPSIS +Update or add an offer to a specific collection of the private store. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Set-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId -PrivateStoreId + [-ETag ] [-IconFileUri ] [-Plan ] [-SpecificPlanIdLimitation ] + [-UpdateSuppressedDueIdempotence] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaJsonFilePath +``` +Set-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId -PrivateStoreId + -JsonFilePath [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaJsonString +``` +Set-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId -PrivateStoreId + -JsonString [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Update or add an offer to a specific collection of the private store. + +## EXAMPLES + +### Example 1: Creates or updates offer to private store collection +```powershell +$acc = @{Accessibility = "azure_managedservices_professional"} +New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -OfferId aumatics.azure_managedservices -Plan $acc +``` + +```output +Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType +---- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- +aumatics.azure_managedservices +``` + +This command creates or updates offer to private store collection. + +## PARAMETERS + +### -CollectionId +The collection ID + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ETag +Identifier for purposes of race condition + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IconFileUri +Icon File Uris + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonFilePath +Path of Json file supplied to the Update operation + +```yaml +Type: System.String +Parameter Sets: UpdateViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Update operation + +```yaml +Type: System.String +Parameter Sets: UpdateViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OfferId +The offer ID to update or delete + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Plan +Offer plans +To construct, see NOTES section for PLAN properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[] +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SpecificPlanIdLimitation +Plan ids limitation for this offer + +```yaml +Type: System.String[] +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UpdateSuppressedDueIdempotence +Indicating whether the offer was not updated to db (true = not updated). +If the allow list is identical to the existed one in db, the offer would not be updated. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Test-AzMarketplacePrivateStoreAnyExistingOffer.md b/src/Marketplace/Marketplace.Autorest/help/Test-AzMarketplacePrivateStoreAnyExistingOffer.md new file mode 100644 index 000000000000..19a28dc97b11 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Test-AzMarketplacePrivateStoreAnyExistingOffer.md @@ -0,0 +1,133 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/test-azmarketplaceprivatestoreanyexistingoffer +schema: 2.0.0 +--- + +# Test-AzMarketplacePrivateStoreAnyExistingOffer + +## SYNOPSIS +Query whether exists any offer in the collections. + +## SYNTAX + +### Any (Default) +``` +Test-AzMarketplacePrivateStoreAnyExistingOffer -PrivateStoreId [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +### AnyViaIdentity +``` +Test-AzMarketplacePrivateStoreAnyExistingOffer -InputObject + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Query whether exists any offer in the collections. + +## EXAMPLES + +### Example 1: Check if exists any offer in the collections. +```powershell +Test-AzMarketplacePrivateStoreAnyExistingOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 +``` + +Query whether exists any offer in the collections. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: AnyViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: Any +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Update-AzMarketplacePrivateStoreCollection.md b/src/Marketplace/Marketplace.Autorest/help/Update-AzMarketplacePrivateStoreCollection.md new file mode 100644 index 000000000000..ca9b3bced60e --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Update-AzMarketplacePrivateStoreCollection.md @@ -0,0 +1,276 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/update-azmarketplaceprivatestorecollection +schema: 2.0.0 +--- + +# Update-AzMarketplacePrivateStoreCollection + +## SYNOPSIS +Create private store collection + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreId [-AllSubscription] + [-Claim ] [-CollectionName ] [-Enabled] [-SubscriptionsList ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzMarketplacePrivateStoreCollection -InputObject [-AllSubscription] + [-Claim ] [-CollectionName ] [-Enabled] [-SubscriptionsList ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityPrivateStore +``` +Update-AzMarketplacePrivateStoreCollection -CollectionId + -PrivateStoreInputObject -Payload [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityPrivateStoreExpanded +``` +Update-AzMarketplacePrivateStoreCollection -CollectionId + -PrivateStoreInputObject [-AllSubscription] [-Claim ] + [-CollectionName ] [-Enabled] [-SubscriptionsList ] [-DefaultProfile ] [-Confirm] + [-WhatIf] [] +``` + +## DESCRIPTION +Create private store collection + +## EXAMPLES + +### Example 1: Update private store collection +```powershell +Update-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId 8c7a91db-cd41-43b6-af47-2e869654126d -Enabled +``` + +Update private store collection. + +## PARAMETERS + +### -AllSubscription +Indicating whether all subscriptions are selected (=true) or not (=false). + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded, UpdateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Claim +Gets or sets the association with Commercial's Billing Account. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded, UpdateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CollectionId +The collection ID + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded, UpdateViaIdentityPrivateStore, UpdateViaIdentityPrivateStoreExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CollectionName +Gets or sets collection name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded, UpdateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Enabled +Indicating whether the collection is enabled or disabled. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded, UpdateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Payload +The Collection data structure. +To construct, see NOTES section for PAYLOAD properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection +Parameter Sets: UpdateViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: UpdateViaIdentityPrivateStore, UpdateViaIdentityPrivateStoreExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -SubscriptionsList +Gets or sets subscription ids list. +Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. +On insert, null is considered as bad request + +```yaml +Type: System.String[] +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded, UpdateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/help/Update-AzMarketplacePrivateStoreCollectionOffer.md b/src/Marketplace/Marketplace.Autorest/help/Update-AzMarketplacePrivateStoreCollectionOffer.md new file mode 100644 index 000000000000..2c5854966b90 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/help/Update-AzMarketplacePrivateStoreCollectionOffer.md @@ -0,0 +1,322 @@ +--- +external help file: +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/update-azmarketplaceprivatestorecollectionoffer +schema: 2.0.0 +--- + +# Update-AzMarketplacePrivateStoreCollectionOffer + +## SYNOPSIS +Update or add an offer to a specific collection of the private store. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId + -PrivateStoreId [-ETag ] [-IconFileUri ] [-Plan ] + [-SpecificPlanIdLimitation ] [-UpdateSuppressedDueIdempotence] [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityCollection +``` +Update-AzMarketplacePrivateStoreCollectionOffer -CollectionInputObject + -OfferId -Payload [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityCollectionExpanded +``` +Update-AzMarketplacePrivateStoreCollectionOffer -CollectionInputObject + -OfferId [-ETag ] [-IconFileUri ] [-Plan ] + [-SpecificPlanIdLimitation ] [-UpdateSuppressedDueIdempotence] [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzMarketplacePrivateStoreCollectionOffer -InputObject [-ETag ] + [-IconFileUri ] [-Plan ] [-SpecificPlanIdLimitation ] + [-UpdateSuppressedDueIdempotence] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityPrivateStore +``` +Update-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId + -PrivateStoreInputObject -Payload [-DefaultProfile ] [-Confirm] + [-WhatIf] [] +``` + +### UpdateViaIdentityPrivateStoreExpanded +``` +Update-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId + -PrivateStoreInputObject [-ETag ] [-IconFileUri ] [-Plan ] + [-SpecificPlanIdLimitation ] [-UpdateSuppressedDueIdempotence] [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Update or add an offer to a specific collection of the private store. + +## EXAMPLES + +### Example 1: Update private store collection offer +```powershell +Update-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId 8c7a91db-cd41-43b6-af47-2e869654126d -OfferId "aumatics.azure_managedservices" -SpecificPlanIdLimitation $null +``` + +Update private store collection offer. + +## PARAMETERS + +### -CollectionId +The collection ID + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded, UpdateViaIdentityPrivateStore, UpdateViaIdentityPrivateStoreExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CollectionInputObject +Identity Parameter +To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: UpdateViaIdentityCollection, UpdateViaIdentityCollectionExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ETag +Identifier for purposes of race condition + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded, UpdateViaIdentityCollectionExpanded, UpdateViaIdentityExpanded, UpdateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IconFileUri +Icon File Uris + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: UpdateExpanded, UpdateViaIdentityCollectionExpanded, UpdateViaIdentityExpanded, UpdateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -OfferId +The offer ID to update or delete + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded, UpdateViaIdentityCollection, UpdateViaIdentityCollectionExpanded, UpdateViaIdentityPrivateStore, UpdateViaIdentityPrivateStoreExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Payload +The privateStore offer data structure. +To construct, see NOTES section for PAYLOAD properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer +Parameter Sets: UpdateViaIdentityCollection, UpdateViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Plan +Offer plans +To construct, see NOTES section for PLAN properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[] +Parameter Sets: UpdateExpanded, UpdateViaIdentityCollectionExpanded, UpdateViaIdentityExpanded, UpdateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: UpdateViaIdentityPrivateStore, UpdateViaIdentityPrivateStoreExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -SpecificPlanIdLimitation +Plan ids limitation for this offer + +```yaml +Type: System.String[] +Parameter Sets: UpdateExpanded, UpdateViaIdentityCollectionExpanded, UpdateViaIdentityExpanded, UpdateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UpdateSuppressedDueIdempotence +Indicating whether the offer was not updated to db (true = not updated). +If the allow list is identical to the existed one in db, the offer would not be updated. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityCollectionExpanded, UpdateViaIdentityExpanded, UpdateViaIdentityPrivateStoreExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer + +## NOTES + +## RELATED LINKS + diff --git a/src/Marketplace/Marketplace.Autorest/internal/Get-AzMarketplaceOperation.ps1 b/src/Marketplace/Marketplace.Autorest/internal/Get-AzMarketplaceOperation.ps1 index 99bb12df6547..c3729ba4955a 100644 --- a/src/Marketplace/Marketplace.Autorest/internal/Get-AzMarketplaceOperation.ps1 +++ b/src/Marketplace/Marketplace.Autorest/internal/Get-AzMarketplaceOperation.ps1 @@ -20,21 +20,17 @@ Lists all of the available Microsoft.Marketplace REST API operations. .Description Lists all of the available Microsoft.Marketplace REST API operations. .Example -PS C:\> {{ Add code here }} - -{{ Add output here }} +{{ Add code here }} .Example -PS C:\> {{ Add code here }} - -{{ Add output here }} +{{ Add code here }} .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResult +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResult .Link https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceoperation #> function Get-AzMarketplaceOperation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResult])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResult])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter()] @@ -42,7 +38,8 @@ param( [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -92,6 +89,7 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ List = 'Az.Marketplace.private\Get-AzMarketplaceOperation_List'; } @@ -101,6 +99,7 @@ begin { $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + throw } } @@ -109,15 +108,18 @@ process { try { $steppablePipeline.Process($_) } catch { + throw } -} +} end { try { $steppablePipeline.End() + } catch { + throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/internal/New-AzMarketplacePrivateStore.ps1 b/src/Marketplace/Marketplace.Autorest/internal/New-AzMarketplacePrivateStore.ps1 index ac5a93efe5aa..5903cbabf99d 100644 --- a/src/Marketplace/Marketplace.Autorest/internal/New-AzMarketplacePrivateStore.ps1 +++ b/src/Marketplace/Marketplace.Autorest/internal/New-AzMarketplacePrivateStore.ps1 @@ -20,14 +20,12 @@ Changes private store properties .Description Changes private store properties .Example -PS C:\> New-AzMarketplacePrivateStore -Id 0000000-0000-00000-0000-000000000000 -Availability 'disabled' -ETag '0000000-0000-00000-0000-000000000000' +New-AzMarketplacePrivateStore -Id 0000000-0000-00000-0000-000000000000 -Availability 'disabled' -ETag '0000000-0000-00000-0000-000000000000' - - -.Inputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore .Outputs System.Boolean .Notes @@ -44,18 +42,12 @@ INPUTOBJECT : Identity Parameter [RequestApprovalId ]: The request approval ID to get create or update PAYLOAD : The PrivateStore data structure. - [SystemDataCreatedAt ]: The timestamp of resource creation (UTC) - [SystemDataCreatedBy ]: The identity that created the resource. - [SystemDataCreatedByType ]: The type of identity that created the resource - [SystemDataLastModifiedAt ]: The timestamp of resource last modification (UTC) - [SystemDataLastModifiedBy ]: The identity that last modified the resource. - [SystemDataLastModifiedByType ]: The type of identity that last modified the resource - [Availability ]: Indicates private store availability + [Availability ]: Indicates private store availability [Branding ]: Gets or sets list of branding characteristics [(Any) ]: This indicates any property can be added to this object. [ETag ]: Identifier for purposes of race condition [IsGov ]: Is government - [NotificationSettingRecipient ]: Gets or sets list of notified recipients for new requests + [NotificationSettingRecipient >]: Gets or sets list of notified recipients for new requests [PrincipalId ]: Principal ID [NotificationSettingSendToAllMarketplaceAdmin ]: Gets or sets whether to send email to all marketplace admins for new requests [PrivateStoreName ]: Private Store Name @@ -76,7 +68,7 @@ param( [Parameter(Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore] # The PrivateStore data structure. # To construct, see NOTES section for PAYLOAD properties and create a hash table. ${Payload}, @@ -86,7 +78,8 @@ param( [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -142,6 +135,7 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ CreateViaIdentity = 'Az.Marketplace.private\New-AzMarketplacePrivateStore_CreateViaIdentity'; } @@ -151,6 +145,7 @@ begin { $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + throw } } @@ -159,15 +154,18 @@ process { try { $steppablePipeline.Process($_) } catch { + throw } -} +} end { try { $steppablePipeline.End() + } catch { + throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/internal/New-AzMarketplacePrivateStoreCollection.ps1 b/src/Marketplace/Marketplace.Autorest/internal/New-AzMarketplacePrivateStoreCollection.ps1 index dee46d74c9e8..509c6726b9f6 100644 --- a/src/Marketplace/Marketplace.Autorest/internal/New-AzMarketplacePrivateStoreCollection.ps1 +++ b/src/Marketplace/Marketplace.Autorest/internal/New-AzMarketplacePrivateStoreCollection.ps1 @@ -16,22 +16,18 @@ <# .Synopsis -Create or update private store collection +Create private store collection .Description -Create or update private store collection +Create private store collection .Example -PS C:\> New-AzMarketplacePrivateStoreCollection -CollectionName test -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -SubscriptionsList 7f5402e4-e8f4-46bd-9bd1-8d27866a606b - -Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ----- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- -fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 12/13/2021 11:12:27 AM User 12/13/2021 11:12:27 AM User +New-AzMarketplacePrivateStoreCollection -CollectionName test -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -SubscriptionsList 7f5402e4-e8f4-46bd-9bd1-8d27866a606b .Inputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection .Notes COMPLEX PARAMETER PROPERTIES @@ -46,22 +42,16 @@ INPUTOBJECT : Identity Parameter [RequestApprovalId ]: The request approval ID to get create or update PAYLOAD : The Collection data structure. - [SystemDataCreatedAt ]: The timestamp of resource creation (UTC) - [SystemDataCreatedBy ]: The identity that created the resource. - [SystemDataCreatedByType ]: The type of identity that created the resource - [SystemDataLastModifiedAt ]: The timestamp of resource last modification (UTC) - [SystemDataLastModifiedBy ]: The identity that last modified the resource. - [SystemDataLastModifiedByType ]: The type of identity that last modified the resource [AllSubscription ]: Indicating whether all subscriptions are selected (=true) or not (=false). [Claim ]: Gets or sets the association with Commercial's Billing Account. [CollectionName ]: Gets or sets collection name. [Enabled ]: Indicating whether the collection is enabled or disabled. - [SubscriptionsList ]: Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request + [SubscriptionsList >]: Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request .Link https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollection #> function New-AzMarketplacePrivateStoreCollection { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection])] [CmdletBinding(DefaultParameterSetName='CreateViaIdentity', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory, ValueFromPipeline)] @@ -73,7 +63,7 @@ param( [Parameter(Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection] # The Collection data structure. # To construct, see NOTES section for PAYLOAD properties and create a hash table. ${Payload}, @@ -83,7 +73,8 @@ param( [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -133,6 +124,7 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ CreateViaIdentity = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollection_CreateViaIdentity'; } @@ -142,6 +134,7 @@ begin { $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + throw } } @@ -150,15 +143,18 @@ process { try { $steppablePipeline.Process($_) } catch { + throw } -} +} end { try { $steppablePipeline.End() + } catch { + throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/internal/New-AzMarketplacePrivateStoreCollectionOffer.ps1 b/src/Marketplace/Marketplace.Autorest/internal/New-AzMarketplacePrivateStoreCollectionOffer.ps1 index bc29afd2f483..a1ca8105246f 100644 --- a/src/Marketplace/Marketplace.Autorest/internal/New-AzMarketplacePrivateStoreCollectionOffer.ps1 +++ b/src/Marketplace/Marketplace.Autorest/internal/New-AzMarketplacePrivateStoreCollectionOffer.ps1 @@ -20,19 +20,15 @@ Update or add an offer to a specific collection of the private store. .Description Update or add an offer to a specific collection of the private store. .Example -PS C:\>$acc = @{Accessibility = "azure_managedservices_professional"} -PS C:\> New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -OfferId aumatics.azure_managedservices -Plan $acc +$acc = @{Accessibility = "azure_managedservices_professional"} +New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -OfferId aumatics.azure_managedservices -Plan $acc -Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ----- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- -aumatics.azure_managedservices - -.Inputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer .Notes COMPLEX PARAMETER PROPERTIES @@ -47,24 +43,18 @@ INPUTOBJECT : Identity Parameter [RequestApprovalId ]: The request approval ID to get create or update PAYLOAD : The privateStore offer data structure. - [SystemDataCreatedAt ]: The timestamp of resource creation (UTC) - [SystemDataCreatedBy ]: The identity that created the resource. - [SystemDataCreatedByType ]: The type of identity that created the resource - [SystemDataLastModifiedAt ]: The timestamp of resource last modification (UTC) - [SystemDataLastModifiedBy ]: The identity that last modified the resource. - [SystemDataLastModifiedByType ]: The type of identity that last modified the resource [ETag ]: Identifier for purposes of race condition [IconFileUri ]: Icon File Uris [(Any) ]: This indicates any property can be added to this object. - [Plan ]: Offer plans - [Accessibility ]: Plan accessibility - [SpecificPlanIdsLimitation ]: Plan ids limitation for this offer + [Plan >]: Offer plans + [Accessibility ]: Plan accessibility + [SpecificPlanIdsLimitation >]: Plan ids limitation for this offer [UpdateSuppressedDueIdempotence ]: Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated. .Link https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollectionoffer #> function New-AzMarketplacePrivateStoreCollectionOffer { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer])] [CmdletBinding(DefaultParameterSetName='CreateViaIdentity', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory, ValueFromPipeline)] @@ -76,7 +66,7 @@ param( [Parameter(Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer] # The privateStore offer data structure. # To construct, see NOTES section for PAYLOAD properties and create a hash table. ${Payload}, @@ -86,7 +76,8 @@ param( [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -136,6 +127,7 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ CreateViaIdentity = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOffer_CreateViaIdentity'; } @@ -145,6 +137,7 @@ begin { $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + throw } } @@ -153,15 +146,18 @@ process { try { $steppablePipeline.Process($_) } catch { + throw } -} +} end { try { $steppablePipeline.End() + } catch { + throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/internal/ProxyCmdletDefinitions.ps1 b/src/Marketplace/Marketplace.Autorest/internal/ProxyCmdletDefinitions.ps1 index c5da176e381b..e36dae25991d 100644 --- a/src/Marketplace/Marketplace.Autorest/internal/ProxyCmdletDefinitions.ps1 +++ b/src/Marketplace/Marketplace.Autorest/internal/ProxyCmdletDefinitions.ps1 @@ -20,21 +20,17 @@ Lists all of the available Microsoft.Marketplace REST API operations. .Description Lists all of the available Microsoft.Marketplace REST API operations. .Example -PS C:\> {{ Add code here }} - -{{ Add output here }} +{{ Add code here }} .Example -PS C:\> {{ Add code here }} - -{{ Add output here }} +{{ Add code here }} .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResult +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResult .Link https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceoperation #> function Get-AzMarketplaceOperation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOperationListResult])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOperationListResult])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter()] @@ -42,7 +38,8 @@ param( [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -92,6 +89,7 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ List = 'Az.Marketplace.private\Get-AzMarketplaceOperation_List'; } @@ -101,6 +99,7 @@ begin { $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + throw } } @@ -109,17 +108,20 @@ process { try { $steppablePipeline.Process($_) } catch { + throw } -} +} end { try { $steppablePipeline.End() + } catch { + throw } -} +} } <# @@ -128,19 +130,15 @@ Update or add an offer to a specific collection of the private store. .Description Update or add an offer to a specific collection of the private store. .Example -PS C:\>$acc = @{Accessibility = "azure_managedservices_professional"} -PS C:\> New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -OfferId aumatics.azure_managedservices -Plan $acc - -Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ----- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- -aumatics.azure_managedservices +$acc = @{Accessibility = "azure_managedservices_professional"} +New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -OfferId aumatics.azure_managedservices -Plan $acc -.Inputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer .Notes COMPLEX PARAMETER PROPERTIES @@ -155,24 +153,18 @@ INPUTOBJECT : Identity Parameter [RequestApprovalId ]: The request approval ID to get create or update PAYLOAD : The privateStore offer data structure. - [SystemDataCreatedAt ]: The timestamp of resource creation (UTC) - [SystemDataCreatedBy ]: The identity that created the resource. - [SystemDataCreatedByType ]: The type of identity that created the resource - [SystemDataLastModifiedAt ]: The timestamp of resource last modification (UTC) - [SystemDataLastModifiedBy ]: The identity that last modified the resource. - [SystemDataLastModifiedByType ]: The type of identity that last modified the resource [ETag ]: Identifier for purposes of race condition [IconFileUri ]: Icon File Uris [(Any) ]: This indicates any property can be added to this object. - [Plan ]: Offer plans - [Accessibility ]: Plan accessibility - [SpecificPlanIdsLimitation ]: Plan ids limitation for this offer + [Plan >]: Offer plans + [Accessibility ]: Plan accessibility + [SpecificPlanIdsLimitation >]: Plan ids limitation for this offer [UpdateSuppressedDueIdempotence ]: Indicating whether the offer was not updated to db (true = not updated). If the allow list is identical to the existed one in db, the offer would not be updated. .Link https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollectionoffer #> function New-AzMarketplacePrivateStoreCollectionOffer { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer])] [CmdletBinding(DefaultParameterSetName='CreateViaIdentity', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory, ValueFromPipeline)] @@ -184,7 +176,7 @@ param( [Parameter(Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IOffer] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer] # The privateStore offer data structure. # To construct, see NOTES section for PAYLOAD properties and create a hash table. ${Payload}, @@ -194,7 +186,8 @@ param( [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -244,6 +237,7 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ CreateViaIdentity = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollectionOffer_CreateViaIdentity'; } @@ -253,6 +247,7 @@ begin { $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + throw } } @@ -261,37 +256,36 @@ process { try { $steppablePipeline.Process($_) } catch { + throw } -} +} end { try { $steppablePipeline.End() + } catch { + throw } -} +} } <# .Synopsis -Create or update private store collection +Create private store collection .Description -Create or update private store collection +Create private store collection .Example -PS C:\> New-AzMarketplacePrivateStoreCollection -CollectionName test -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -SubscriptionsList 7f5402e4-e8f4-46bd-9bd1-8d27866a606b - -Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType ----- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- -fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 12/13/2021 11:12:27 AM User 12/13/2021 11:12:27 AM User +New-AzMarketplacePrivateStoreCollection -CollectionName test -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -SubscriptionsList 7f5402e4-e8f4-46bd-9bd1-8d27866a606b .Inputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection .Notes COMPLEX PARAMETER PROPERTIES @@ -306,22 +300,16 @@ INPUTOBJECT : Identity Parameter [RequestApprovalId ]: The request approval ID to get create or update PAYLOAD : The Collection data structure. - [SystemDataCreatedAt ]: The timestamp of resource creation (UTC) - [SystemDataCreatedBy ]: The identity that created the resource. - [SystemDataCreatedByType ]: The type of identity that created the resource - [SystemDataLastModifiedAt ]: The timestamp of resource last modification (UTC) - [SystemDataLastModifiedBy ]: The identity that last modified the resource. - [SystemDataLastModifiedByType ]: The type of identity that last modified the resource [AllSubscription ]: Indicating whether all subscriptions are selected (=true) or not (=false). [Claim ]: Gets or sets the association with Commercial's Billing Account. [CollectionName ]: Gets or sets collection name. [Enabled ]: Indicating whether the collection is enabled or disabled. - [SubscriptionsList ]: Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request + [SubscriptionsList >]: Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request .Link https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollection #> function New-AzMarketplacePrivateStoreCollection { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection])] [CmdletBinding(DefaultParameterSetName='CreateViaIdentity', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory, ValueFromPipeline)] @@ -333,7 +321,7 @@ param( [Parameter(Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollection] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection] # The Collection data structure. # To construct, see NOTES section for PAYLOAD properties and create a hash table. ${Payload}, @@ -343,7 +331,8 @@ param( [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -393,6 +382,7 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ CreateViaIdentity = 'Az.Marketplace.private\New-AzMarketplacePrivateStoreCollection_CreateViaIdentity'; } @@ -402,6 +392,7 @@ begin { $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + throw } } @@ -410,17 +401,20 @@ process { try { $steppablePipeline.Process($_) } catch { + throw } -} +} end { try { $steppablePipeline.End() + } catch { + throw } -} +} } <# @@ -429,14 +423,12 @@ Changes private store properties .Description Changes private store properties .Example -PS C:\> New-AzMarketplacePrivateStore -Id 0000000-0000-00000-0000-000000000000 -Availability 'disabled' -ETag '0000000-0000-00000-0000-000000000000' - - +New-AzMarketplacePrivateStore -Id 0000000-0000-00000-0000-000000000000 -Availability 'disabled' -ETag '0000000-0000-00000-0000-000000000000' -.Inputs -Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore .Inputs Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore .Outputs System.Boolean .Notes @@ -453,18 +445,12 @@ INPUTOBJECT : Identity Parameter [RequestApprovalId ]: The request approval ID to get create or update PAYLOAD : The PrivateStore data structure. - [SystemDataCreatedAt ]: The timestamp of resource creation (UTC) - [SystemDataCreatedBy ]: The identity that created the resource. - [SystemDataCreatedByType ]: The type of identity that created the resource - [SystemDataLastModifiedAt ]: The timestamp of resource last modification (UTC) - [SystemDataLastModifiedBy ]: The identity that last modified the resource. - [SystemDataLastModifiedByType ]: The type of identity that last modified the resource - [Availability ]: Indicates private store availability + [Availability ]: Indicates private store availability [Branding ]: Gets or sets list of branding characteristics [(Any) ]: This indicates any property can be added to this object. [ETag ]: Identifier for purposes of race condition [IsGov ]: Is government - [NotificationSettingRecipient ]: Gets or sets list of notified recipients for new requests + [NotificationSettingRecipient >]: Gets or sets list of notified recipients for new requests [PrincipalId ]: Principal ID [NotificationSettingSendToAllMarketplaceAdmin ]: Gets or sets whether to send email to all marketplace admins for new requests [PrivateStoreName ]: Private Store Name @@ -485,7 +471,7 @@ param( [Parameter(Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPrivateStore] + [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPrivateStore] # The PrivateStore data structure. # To construct, see NOTES section for PAYLOAD properties and create a hash table. ${Payload}, @@ -495,7 +481,8 @@ param( [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Category('Azure')] [System.Management.Automation.PSObject] - # The credentials, account, tenant, and subscription used for communication with Azure. + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter(DontShow)] @@ -551,6 +538,7 @@ begin { $PSBoundParameters['OutBuffer'] = 1 } $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ CreateViaIdentity = 'Az.Marketplace.private\New-AzMarketplacePrivateStore_CreateViaIdentity'; } @@ -560,6 +548,7 @@ begin { $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } catch { + throw } } @@ -568,15 +557,18 @@ process { try { $steppablePipeline.Process($_) } catch { + throw } -} +} end { try { $steppablePipeline.End() + } catch { + throw } -} +} } diff --git a/src/Marketplace/Marketplace.Autorest/internal/README.md b/src/Marketplace/Marketplace.Autorest/internal/README.md index 0b95163b9a7c..48f045526700 100644 --- a/src/Marketplace/Marketplace.Autorest/internal/README.md +++ b/src/Marketplace/Marketplace.Autorest/internal/README.md @@ -1,5 +1,5 @@ # Internal -This directory contains a module to handle *internal only* cmdlets. Cmdlets that you **hide** in configuration are created here. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression). The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation. +This directory contains a module to handle *internal only* cmdlets. Cmdlets that you **hide** in configuration are created here. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest.powershell/blob/main/docs/directives.md#cmdlet-hiding-exportation-suppression). The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation. ## Info - Modifiable: no @@ -11,4 +11,4 @@ This directory contains a module to handle *internal only* cmdlets. Cmdlets that The `Az.Marketplace.internal.psm1` file is generated to this folder. This module file handles the hidden cmdlets. These cmdlets will not be exported by `Az.Marketplace`. Instead, this sub-module is imported by the `..\custom\Az.Marketplace.custom.psm1` module, allowing you to use hidden cmdlets in your custom, exposed cmdlets. To call these cmdlets in your custom scripts, simply use [module-qualified calls](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_command_precedence?view=powershell-6#qualified-names). For example, `Az.Marketplace.internal\Get-Example` would call an internal cmdlet named `Get-Example`. ## Purpose -This allows you to include REST specifications for services that you *do not wish to expose from your module*, but simply want to call within custom cmdlets. For example, if you want to make a custom cmdlet that uses `Storage` services, you could include a simplified `Storage` REST specification that has only the operations you need. When you run the generator and build this module, note the generated `Storage` cmdlets. Then, in your readme configuration, use [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) on the `Storage` cmdlets and they will *only be exposed to the custom cmdlets* you want to write, and not be exported as part of `Az.Marketplace`. \ No newline at end of file +This allows you to include REST specifications for services that you *do not wish to expose from your module*, but simply want to call within custom cmdlets. For example, if you want to make a custom cmdlet that uses `Storage` services, you could include a simplified `Storage` REST specification that has only the operations you need. When you run the generator and build this module, note the generated `Storage` cmdlets. Then, in your readme configuration, use [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) on the `Storage` cmdlets and they will *only be exposed to the custom cmdlets* you want to write, and not be exported as part of `Az.Marketplace`. diff --git a/src/Marketplace/Marketplace.Autorest/run-module.ps1 b/src/Marketplace/Marketplace.Autorest/run-module.ps1 index 7d012e57b653..c1559f41f4ad 100644 --- a/src/Marketplace/Marketplace.Autorest/run-module.ps1 +++ b/src/Marketplace/Marketplace.Autorest/run-module.ps1 @@ -12,19 +12,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code # is regenerated. # ---------------------------------------------------------------------------------- -param([switch]$Isolated, [switch]$Code) +param([switch]$NotIsolated, [switch]$Code) $ErrorActionPreference = 'Stop' -if(-not $Isolated) { +if(-not $NotIsolated) { Write-Host -ForegroundColor Green 'Creating isolated process...' $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path - & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated return } $isAzure = $true if($isAzure) { - . (Join-Path $PSScriptRoot 'check-dependencies.ps1') -Isolated -Accounts + . (Join-Path $PSScriptRoot 'check-dependencies.ps1') -NotIsolated -Accounts # Load the latest version of Az.Accounts installed Import-Module -Name Az.Accounts -RequiredVersion (Get-Module -Name Az.Accounts -ListAvailable | Sort-Object -Property Version -Descending)[0].Version } diff --git a/src/Marketplace/Marketplace.Autorest/test-module.ps1 b/src/Marketplace/Marketplace.Autorest/test-module.ps1 index 33129c3e146e..da9c9f183216 100644 --- a/src/Marketplace/Marketplace.Autorest/test-module.ps1 +++ b/src/Marketplace/Marketplace.Autorest/test-module.ps1 @@ -12,17 +12,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code # is regenerated. # ---------------------------------------------------------------------------------- -param([switch]$Isolated, [switch]$Live, [switch]$Record, [switch]$Playback, [switch]$RegenerateSupportModule, [switch]$UsePreviousConfigForRecord, [string[]]$TestName) +param([switch]$NotIsolated, [switch]$Live, [switch]$Record, [switch]$Playback, [switch]$RegenerateSupportModule, [switch]$UsePreviousConfigForRecord, [string[]]$TestName) $ErrorActionPreference = 'Stop' -if(-not $Isolated) +if(-not $NotIsolated) { Write-Host -ForegroundColor Green 'Creating isolated process...' if ($PSBoundParameters.ContainsKey("TestName")) { $PSBoundParameters["TestName"] = $PSBoundParameters["TestName"] -join "," } $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path - & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -NotIsolated return } @@ -34,7 +34,7 @@ if ($PSBoundParameters.ContainsKey("TestName") -and ($TestName.count -eq 1) -and $ProgressPreference = 'SilentlyContinue' $baseName = $PSScriptRoot.BaseName $requireResourceModule = (($baseName -ne "Resources") -and ($Record.IsPresent -or $Live.IsPresent)) -. (Join-Path $PSScriptRoot 'check-dependencies.ps1') -Isolated -Accounts:$false -Pester -Resources:$requireResourceModule -RegenerateSupportModule:$RegenerateSupportModule +. (Join-Path $PSScriptRoot 'check-dependencies.ps1') -NotIsolated -Accounts:$false -Pester -Resources:$requireResourceModule -RegenerateSupportModule:$RegenerateSupportModule . ("$PSScriptRoot\test\utils.ps1") if ($requireResourceModule) @@ -91,4 +91,4 @@ try } } -Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file +Write-Host -ForegroundColor Green '-------------Done-------------' diff --git a/src/Marketplace/Marketplace.Autorest/test/Copy-AzMarketplacePrivateStoreCollectionOffer.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Copy-AzMarketplacePrivateStoreCollectionOffer.Recording.json index 475dace8b0ad..7b8c10efe1f0 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Copy-AzMarketplacePrivateStoreCollectionOffer.Recording.json +++ b/src/Marketplace/Marketplace.Autorest/test/Copy-AzMarketplacePrivateStoreCollectionOffer.Recording.json @@ -1,15 +1,15 @@ { - "Copy-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+TransferExpanded+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/transferOffers?api-version=2021-06-01+1": { + "Copy-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+TransferExpanded+$PUT+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/offers/aumatics.azure_managedservices?api-version=2023-01-01+1": { "Request": { - "Method": "POST", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/transferOffers?api-version=2021-06-01", - "Content": "{\n \"properties\": {\n \"targetCollections\": [ \"8c7a91db-cd41-43b6-af47-2e869654126d\" ],\n \"operation\": \"Copy\",\n \"offerIdsList\": [ \"aumatics.azure_managedservices\" ]\n }\n}", + "Method": "PUT", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/offers/aumatics.azure_managedservices?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"plans\": [\r\n {\r\n \"accessibility\": \"azure_managedservices_professional\"\r\n }\r\n ]\r\n }\r\n}", "isContentBase64": false, "Headers": { }, "ContentHeaders": { "Content-Type": [ "application/json" ], - "Content-Length": [ "176" ] + "Content-Length": [ "132" ] } }, "Response": { @@ -17,27 +17,75 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1198" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=a1932161769a8d1e756ea2a33c09d2511fa99932f8d921493de9f93092d8c165;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=a1932161769a8d1e756ea2a33c09d2511fa99932f8d921493de9f93092d8c165;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121436Z-e9fr18rg4936d7qwr39u9d2ats00000002x0000000007s6m" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "4045343e-4ad4-42ed-b0dd-5b7ef5d12f87" ], + "x-ms-correlation-request-id": [ "4045343e-4ad4-42ed-b0dd-5b7ef5d12f87" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121437Z:4045343e-4ad4-42ed-b0dd-5b7ef5d12f87" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: 5B8A08708B9447CA8FC0164714E005A0 Ref B: MRS211050313051 Ref C: 2024-02-06T12:14:36Z" ], + "Date": [ "Tue, 06 Feb 2024 12:14:36 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "523" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/offers/aumatics.azure_managedservices\",\"name\":\"aumatics.azure_managedservices\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"aumatics.azure_managedservices\",\"specificPlanIdsLimitation\":null,\"eTag\":\"\\\"c303ee7f-0000-0100-0000-65c0b1020000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":true}}", + "isContentBase64": false + } + }, + "Copy-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+TransferExpanded+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/transferOffers?api-version=2023-01-01+2": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/transferOffers?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"targetCollections\": [ \"8c7a91db-cd41-43b6-af47-2e869654126d\" ],\r\n \"operation\": \"Copy\",\r\n \"offerIdsList\": [ \"aumatics.azure_managedservices\" ]\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "182" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], "x-ms-ratelimit-remaining-tenant-writes": [ "1199" ], - "x-ms-request-id": [ "6fd5ea4b-5317-4292-8f5e-967be4dbed2b" ], - "x-ms-correlation-request-id": [ "6fd5ea4b-5317-4292-8f5e-967be4dbed2b" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135823Z:6fd5ea4b-5317-4292-8f5e-967be4dbed2b" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121437Z-un93fkbvw50w5bbm67x1677wk800000009c0000000008kp5" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "b2f187b1-26e8-48b9-ac90-3f2f048b23b3" ], + "x-ms-correlation-request-id": [ "b2f187b1-26e8-48b9-ac90-3f2f048b23b3" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121437Z:b2f187b1-26e8-48b9-ac90-3f2f048b23b3" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:58:23 GMT" ] + "X-MSEdge-Ref": [ "Ref A: D049F26F0D3E4DAFAC388F3ECB2FCFA0 Ref B: MRS211050313051 Ref C: 2024-02-06T12:14:37Z" ], + "Date": [ "Tue, 06 Feb 2024 12:14:36 GMT" ] }, "ContentHeaders": { - "Content-Length": [ "108" ], + "Content-Length": [ "115" ], "Content-Type": [ "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "Content": "{\"succeeded\":[{\"collectionName\":\"test1\",\"collectionId\":\"8c7a91db-cd41-43b6-af47-2e869654126d\"}],\"failed\":[]}", + "Content": "{\"succeeded\":[{\"collectionName\":\"CopyPWRTest1\",\"collectionId\":\"8c7a91db-cd41-43b6-af47-2e869654126d\"}],\"failed\":[]}", "isContentBase64": false } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Copy-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Copy-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 index 05e0e2b8bdf3..ceb0ebe14b44 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Copy-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 +++ b/src/Marketplace/Marketplace.Autorest/test/Copy-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 @@ -16,8 +16,12 @@ if(($null -eq $TestName) -or ($TestName -contains 'Copy-AzMarketplacePrivateStor Describe 'Copy-AzMarketplacePrivateStoreCollectionOffer' { It 'TransferExpanded' { + + $acc = @{Accessibility = "azure_managedservices_professional"} + New-AzMarketplacePrivateStoreCollectionOffer -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -OfferId aumatics.azure_managedservices -Plan $acc + $payload = @{OfferIdsList = "aumatics.azure_managedservices"; Operation = "Copy"; TargetCollection = "8c7a91db-cd41-43b6-af47-2e869654126d"} - $res = Copy-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 -Payload $payload - $res.Succeeded.Count | Should -Be 1 + $res = Copy-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 -Payload $payload + $res.Succeeded.Count | Should -Be 1 } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Disable-AzMarketplacePrivateStoreCollectionAllItem.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Disable-AzMarketplacePrivateStoreCollectionAllItem.Recording.json new file mode 100644 index 000000000000..56c6092c8917 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Disable-AzMarketplacePrivateStoreCollectionAllItem.Recording.json @@ -0,0 +1,52 @@ +{ + "Disable-AzMarketplacePrivateStoreCollectionAllItem+[NoContext]+Disable+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188/disableApproveAllItems?api-version=2023-01-01+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188/disableApproveAllItems?api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "1bd0b9f6-622f-45a2-b342-1162b65366ea" ], + "CommandName": [ "Disable-AzMarketplacePrivateStoreCollectionAllItem" ], + "FullCommandName": [ "Disable-AzMarketplacePrivateStoreCollectionAllItem_Disable" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1199" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121438Z-gwknnxeka10xrfzb2a991aarkg0000000as000000000anyk" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "aa3a6f7f-b7c8-45b7-a226-f3aff08503b9" ], + "x-ms-correlation-request-id": [ "aa3a6f7f-b7c8-45b7-a226-f3aff08503b9" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121438Z:aa3a6f7f-b7c8-45b7-a226-f3aff08503b9" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: 7577B7C00FCF407280C00EE4D7944621 Ref B: MRS211050313051 Ref C: 2024-02-06T12:14:38Z" ], + "Date": [ "Tue, 06 Feb 2024 12:14:38 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "777" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2024-02-06T12:14:34.5033797Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-02-06T12:14:38.8098396Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188\",\"name\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa0188\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":null,\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"2024-02-06T12:14:38.8098396Z\",\"collectionId\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa0188\",\"collectionName\":\"AllItemsPWRTest1\",\"claim\":null,\"allSubscriptions\":false,\"subscriptionsList\":[\"1052ff5a-aa43-4ca1-bd18-010399494ce5\"],\"enabled\":false,\"numberOfOffers\":0}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/test/Disable-AzMarketplacePrivateStoreCollectionAllItem.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Disable-AzMarketplacePrivateStoreCollectionAllItem.Tests.ps1 new file mode 100644 index 000000000000..c7b4a8ebea87 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Disable-AzMarketplacePrivateStoreCollectionAllItem.Tests.ps1 @@ -0,0 +1,23 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Disable-AzMarketplacePrivateStoreCollectionAllItem')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Disable-AzMarketplacePrivateStoreCollectionAllItem.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Disable-AzMarketplacePrivateStoreCollectionAllItem' { + It 'Disable' { + $response = Disable-AzMarketplacePrivateStoreCollectionAllItem -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 + $response | Should -Not -Be $null + $response.ApproveAllItem | Should -Be $false + } +} diff --git a/src/Marketplace/Marketplace.Autorest/test/Enable-AzMarketplacePrivateStoreCollectionAllItem.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Enable-AzMarketplacePrivateStoreCollectionAllItem.Recording.json new file mode 100644 index 000000000000..34385d945a60 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Enable-AzMarketplacePrivateStoreCollectionAllItem.Recording.json @@ -0,0 +1,52 @@ +{ + "Enable-AzMarketplacePrivateStoreCollectionAllItem+[NoContext]+Approve+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188/approveAllItems?api-version=2023-01-01+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188/approveAllItems?api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "6" ], + "x-ms-client-request-id": [ "2d981ebd-a96d-4d5c-8ef9-0215acf6391a" ], + "CommandName": [ "Enable-AzMarketplacePrivateStoreCollectionAllItem" ], + "FullCommandName": [ "Enable-AzMarketplacePrivateStoreCollectionAllItem_Approve" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1198" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121439Z-e9fr18rg4936d7qwr39u9d2ats00000002y0000000007rkd" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "79e412f0-32b4-4498-a4bf-03677947ccee" ], + "x-ms-correlation-request-id": [ "79e412f0-32b4-4498-a4bf-03677947ccee" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121440Z:79e412f0-32b4-4498-a4bf-03677947ccee" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: 713E24FA06F84BB395EF778BE9091772 Ref B: MRS211050313051 Ref C: 2024-02-06T12:14:39Z" ], + "Date": [ "Tue, 06 Feb 2024 12:14:39 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "777" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2024-02-06T12:14:34.5033797Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-02-06T12:14:38.8098396Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188\",\"name\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa0188\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":null,\"approveAllItems\":true,\"approveAllItemsModifiedAt\":\"2024-02-06T12:14:39.9160000Z\",\"collectionId\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa0188\",\"collectionName\":\"AllItemsPWRTest1\",\"claim\":null,\"allSubscriptions\":false,\"subscriptionsList\":[\"1052ff5a-aa43-4ca1-bd18-010399494ce5\"],\"enabled\":false,\"numberOfOffers\":-1}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/test/Enable-AzMarketplacePrivateStoreCollectionAllItem.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Enable-AzMarketplacePrivateStoreCollectionAllItem.Tests.ps1 new file mode 100644 index 000000000000..c8efdd96b005 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Enable-AzMarketplacePrivateStoreCollectionAllItem.Tests.ps1 @@ -0,0 +1,23 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Enable-AzMarketplacePrivateStoreCollectionAllItem')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Enable-AzMarketplacePrivateStoreCollectionAllItem.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Enable-AzMarketplacePrivateStoreCollectionAllItem' { + It 'Approve' { + $response = Enable-AzMarketplacePrivateStoreCollectionAllItem -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 + $response | Should -Not -Be $null + $response.ApproveAllItem | Should -Be $true + } +} diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceBillingPrivateStoreAccount.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceBillingPrivateStoreAccount.Recording.json index 9db265999872..6e1cc36625de 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceBillingPrivateStoreAccount.Recording.json +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceBillingPrivateStoreAccount.Recording.json @@ -1,17 +1,17 @@ { - "Get-AzMarketplaceBillingPrivateStoreAccount+[NoContext]+Billing+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/billingAccounts?api-version=2021-06-01+1": { + "Get-AzMarketplaceBillingPrivateStoreAccount+[NoContext]+Billing+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/billingAccounts?api-version=2023-01-01+1": { "Request": { "Method": "POST", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/billingAccounts?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/billingAccounts?api-version=2023-01-01", "Content": null, "isContentBase64": false, "Headers": { - "x-ms-unique-id": [ "3" ], - "x-ms-client-request-id": [ "46e59431-831d-4ca8-ace2-b207e858b1cd" ], + "x-ms-unique-id": [ "7" ], + "x-ms-client-request-id": [ "6f21f224-99d8-4590-a50d-a2e54b6c992f" ], "CommandName": [ "Get-AzMarketplaceBillingPrivateStoreAccount" ], "FullCommandName": [ "Get-AzMarketplaceBillingPrivateStoreAccount_Billing" ], "ParameterSetName": [ "__AllParameterSets" ], - "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], "Authorization": [ "[Filtered]" ] }, "ContentHeaders": { @@ -22,20 +22,23 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1197" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-writes": [ "1198" ], - "x-ms-request-id": [ "52a15ae6-9137-4bc0-8f30-76005c9e138b" ], - "x-ms-correlation-request-id": [ "52a15ae6-9137-4bc0-8f30-76005c9e138b" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135827Z:52a15ae6-9137-4bc0-8f30-76005c9e138b" ], + "x-azure-ref": [ "20240206T121440Z-e9fr18rg4936d7qwr39u9d2ats00000002y0000000007rpd" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "710f7c51-ae41-4408-9a70-aeb94ca9cf89" ], + "x-ms-correlation-request-id": [ "710f7c51-ae41-4408-9a70-aeb94ca9cf89" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121440Z:710f7c51-ae41-4408-9a70-aeb94ca9cf89" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:58:27 GMT" ] + "X-MSEdge-Ref": [ "Ref A: 6FC13175CEFA46A986CFD3CEBDB127F1 Ref B: MRS211050313051 Ref C: 2024-02-06T12:14:40Z" ], + "Date": [ "Tue, 06 Feb 2024 12:14:40 GMT" ] }, "ContentHeaders": { "Content-Length": [ "22" ], diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceBillingPrivateStoreAccount.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceBillingPrivateStoreAccount.Tests.ps1 index 6c94152027bd..39d4c76901ac 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceBillingPrivateStoreAccount.Tests.ps1 +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceBillingPrivateStoreAccount.Tests.ps1 @@ -16,8 +16,8 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzMarketplaceBillingPriva Describe 'Get-AzMarketplaceBillingPrivateStoreAccount' { It 'Billing' { - $BillingAccount = Get-AzMarketplaceBillingPrivateStoreAccount -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 - $BillingAccount | Should -Be $null + $BillingAccount = Get-AzMarketplaceBillingPrivateStoreAccount -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 + $BillingAccount | Should -Be $null } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceCollectionPrivateStoreToSubscriptionMapping.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceCollectionPrivateStoreToSubscriptionMapping.Recording.json deleted file mode 100644 index 25178f36b805..000000000000 --- a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceCollectionPrivateStoreToSubscriptionMapping.Recording.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "Get-AzMarketplaceCollectionPrivateStoreToSubscriptionMapping+[NoContext]+CollectionsExpanded+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collectionsToSubscriptionsMapping?api-version=2021-06-01+1": { - "Request": { - "Method": "POST", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collectionsToSubscriptionsMapping?api-version=2021-06-01", - "Content": "{\n \"properties\": {\n \"subscriptionIds\": [ \"1052ff5a-aa43-4ca1-bd18-010399494ce5\" ]\n }\n}", - "isContentBase64": false, - "Headers": { - }, - "ContentHeaders": { - "Content-Type": [ "application/json" ], - "Content-Length": [ "91" ] - } - }, - "Response": { - "StatusCode": 200, - "Headers": { - "Cache-Control": [ "no-cache" ], - "Pragma": [ "no-cache" ], - "Vary": [ "Accept-Encoding" ], - "X-Content-Type-Options": [ "nosniff" ], - "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01808.0002-f172fc53" ], - "Set-Cookie": [ "ARRAffinity=6915894304dda5088a4956a5bf7a84ac06d25dc86c67b8df917e89aa9350af97;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=6915894304dda5088a4956a5bf7a84ac06d25dc86c67b8df917e89aa9350af97;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], - "X-AspNet-Version": [ "4.0.30319" ], - "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-writes": [ "1197" ], - "x-ms-request-id": [ "28066df4-5040-43a9-b2d3-814e344c6fad" ], - "x-ms-correlation-request-id": [ "28066df4-5040-43a9-b2d3-814e344c6fad" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20211226T150826Z:28066df4-5040-43a9-b2d3-814e344c6fad" ], - "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Sun, 26 Dec 2021 15:08:25 GMT" ] - }, - "ContentHeaders": { - "Content-Length": [ "283" ], - "Content-Type": [ "application/json; charset=utf-8" ], - "Expires": [ "-1" ] - }, - "Content": "{\"details\":{\"a260d38c-96cf-492d-a340-404d0c4b3ad6\":{\"collectionName\":\"DefaultCollection\",\"subscriptions\":[\"1052ff5a-aa43-4ca1-bd18-010399494ce5\"]},\"8c7a91db-cd41-43b6-af47-2e869654126d\":{\"collectionName\":\"Demo collection 1\",\"subscriptions\":[\"1052ff5a-aa43-4ca1-bd18-010399494ce5\"]}}}", - "isContentBase64": false - } - } -} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceCollectionToSubscriptionMapping.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceCollectionToSubscriptionMapping.Recording.json index c49e1ce1e5a5..ac407ef0f4fd 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceCollectionToSubscriptionMapping.Recording.json +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceCollectionToSubscriptionMapping.Recording.json @@ -1,15 +1,15 @@ { - "Get-AzMarketplaceCollectionToSubscriptionMapping+[NoContext]+CollectionsExpanded+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collectionsToSubscriptionsMapping?api-version=2021-06-01+1": { + "Get-AzMarketplaceCollectionToSubscriptionMapping+[NoContext]+CollectionsExpanded+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collectionsToSubscriptionsMapping?api-version=2023-01-01+1": { "Request": { "Method": "POST", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collectionsToSubscriptionsMapping?api-version=2021-06-01", - "Content": "{\n \"properties\": {\n \"subscriptionIds\": [ \"1052ff5a-aa43-4ca1-bd18-010399494ce5\" ]\n }\n}", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collectionsToSubscriptionsMapping?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"subscriptionIds\": [ \"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\" ]\r\n }\r\n}", "isContentBase64": false, "Headers": { }, "ContentHeaders": { "Content-Type": [ "application/json" ], - "Content-Length": [ "91" ] + "Content-Length": [ "95" ] } }, "Response": { @@ -17,27 +17,30 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1194" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=d3888da00a6c22fd6922d241b1e1f8b74760295bc9888c172907d962f5a68055;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=d3888da00a6c22fd6922d241b1e1f8b74760295bc9888c172907d962f5a68055;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-writes": [ "1197" ], - "x-ms-request-id": [ "ab14cf95-7090-4f5b-8cb5-0458bb065c89" ], - "x-ms-correlation-request-id": [ "ab14cf95-7090-4f5b-8cb5-0458bb065c89" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135831Z:ab14cf95-7090-4f5b-8cb5-0458bb065c89" ], + "x-azure-ref": [ "20240206T121441Z-e9fr18rg4936d7qwr39u9d2ats00000002x0000000007sae" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "0d64c3ec-bded-4ea2-8882-b1fe43d4eb49" ], + "x-ms-correlation-request-id": [ "0d64c3ec-bded-4ea2-8882-b1fe43d4eb49" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121441Z:0d64c3ec-bded-4ea2-8882-b1fe43d4eb49" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:58:30 GMT" ] + "X-MSEdge-Ref": [ "Ref A: C93C658004844C64B2CC6605DA7AD7EC Ref B: MRS211050313051 Ref C: 2024-02-06T12:14:41Z" ], + "Date": [ "Tue, 06 Feb 2024 12:14:41 GMT" ] }, "ContentHeaders": { - "Content-Length": [ "271" ], + "Content-Length": [ "2123" ], "Content-Type": [ "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "Content": "{\"details\":{\"a260d38c-96cf-492d-a340-404d0c4b3ad6\":{\"collectionName\":\"DefaultCollection\",\"subscriptions\":[\"1052ff5a-aa43-4ca1-bd18-010399494ce5\"]},\"8c7a91db-cd41-43b6-af47-2e869654126d\":{\"collectionName\":\"test1\",\"subscriptions\":[\"1052ff5a-aa43-4ca1-bd18-010399494ce5\"]}}}", + "Content": "{\"details\":{\"a260d38c-96cf-492d-a340-404d0c4b3ad6\":{\"collectionName\":\"DefaultCollection\",\"subscriptions\":[\"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\"]},\"d1bb102f-620f-460e-ba55-fdc3856c8fdd\":{\"collectionName\":\"BigCollection_DONT_DELETE\",\"subscriptions\":[\"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\"]},\"0740a3e6-d5b5-4e22-99be-26887e484fa1\":{\"collectionName\":\"HyltonTest\",\"subscriptions\":[\"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\"]},\"de165278-2dda-40aa-9ce4-15bf37311f49\":{\"collectionName\":\"SaviTest2\",\"subscriptions\":[\"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\"]},\"b411c744-55fd-43b4-b269-faf05d4edae2\":{\"collectionName\":\"AllOffers\",\"subscriptions\":[\"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\"]},\"dbf8cede-24ff-42c0-b443-3f73df6996f7\":{\"collectionName\":\"RulesCollection\",\"subscriptions\":[\"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\"]},\"cf87e6eb-4ed1-44e5-b250-9eb5593b4c0e\":{\"collectionName\":\"TamarTest\",\"subscriptions\":[\"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\"]},\"21ea54a6-df79-4dcb-babf-7860b8a82a9c\":{\"collectionName\":\"TestCanary\",\"subscriptions\":[\"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\"]},\"ac13d584-7c4b-40a6-9d95-7dcf4b79db80\":{\"collectionName\":\"TestBubBash\",\"subscriptions\":null},\"73551ecc-d860-407f-9efa-049bab0468f5\":{\"collectionName\":\"PrivatePlans\",\"subscriptions\":[\"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\"]},\"22dc7ebe-45b7-4aa6-8c96-a30091344cad\":{\"collectionName\":\"bugbashtest\",\"subscriptions\":[\"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\"]},\"5b98b8be-7b7f-46fe-8e97-a15ea77dda14\":{\"collectionName\":\"CanaryTest\",\"subscriptions\":null},\"65159e59-86c8-4442-b768-2595be217a0f\":{\"collectionName\":\"LG\",\"subscriptions\":[\"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\"]},\"d9b76d86-a3e7-4e9b-befb-3fe5a8d070a6\":{\"collectionName\":\"hamzza\",\"subscriptions\":null},\"0a4d89f3-8348-4961-9bec-a02780ab8144\":{\"collectionName\":\"Guy\",\"subscriptions\":[\"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\"]},\"fdb889a1-cf3e-49f0-95b8-2bb012fa01f1\":{\"collectionName\":\"pwshNewCollTest\",\"subscriptions\":null},\"fdb889a1-cf3e-49f0-95b8-2bb012fa0188\":{\"collectionName\":\"AllItemsPWRTest1\",\"subscriptions\":null},\"8c7a91db-cd41-43b6-af47-2e869654126d\":{\"collectionName\":\"CopyPWRTest1\",\"subscriptions\":null}}}", "isContentBase64": false } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceCollectionToSubscriptionMapping.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceCollectionToSubscriptionMapping.Tests.ps1 index a9b1213e981f..c342c2a45e10 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceCollectionToSubscriptionMapping.Tests.ps1 +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceCollectionToSubscriptionMapping.Tests.ps1 @@ -16,7 +16,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzMarketplaceCollectionTo Describe 'Get-AzMarketplaceCollectionToSubscriptionMapping' { It 'CollectionsExpanded' { - $res = Get-AzMarketplaceCollectionToSubscriptionMapping -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -Payload @{SubscriptionId = "1052ff5a-aa43-4ca1-bd18-010399494ce5"} - $res.keys.Count | Should -BeGreaterOrEqual 1 + $response = Get-AzMarketplaceCollectionToSubscriptionMapping -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -Payload @{SubscriptionId = "1f58b5dd-313c-42ed-84fc-f1e351bba7fb"} + $response | Should -Not -Be $null } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.Recording.json new file mode 100644 index 000000000000..d2b500b04b17 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.Recording.json @@ -0,0 +1,52 @@ +{ + "Get-AzMarketplacePrivateStoreAllSubscriptionInTenant+[NoContext]+Fetch+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/fetchAllSubscriptionsInTenant?api-version=2023-01-01+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/fetchAllSubscriptionsInTenant?api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "9" ], + "x-ms-client-request-id": [ "b5f58e2a-76b5-4f52-993f-a191223fef29" ], + "CommandName": [ "Get-AzMarketplacePrivateStoreAllSubscriptionInTenant" ], + "FullCommandName": [ "Get-AzMarketplacePrivateStoreAllSubscriptionInTenant_Fetch" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1198" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121442Z-un93fkbvw50w5bbm67x1677wk800000009c0000000008krq" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "85dbfdf7-72d4-455a-be30-02b3418eb660" ], + "x-ms-correlation-request-id": [ "85dbfdf7-72d4-455a-be30-02b3418eb660" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121442Z:85dbfdf7-72d4-455a-be30-02b3418eb660" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: BC68FB6AB11A42D7AB65C6D92F539D30 Ref B: MRS211050313051 Ref C: 2024-02-06T12:14:42Z" ], + "Date": [ "Tue, 06 Feb 2024 12:14:41 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "398" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"/subscriptions/1f58b5dd-313c-42ed-84fc-f1e351bba7fb\",\"subscriptionId\":\"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\",\"displayName\":\"PrivatestorePAYGSubscription\",\"state\":\"Enabled\"},{\"id\":\"/subscriptions/ab3de7bc-7a6e-4e9f-a34a-f6922df453e4\",\"subscriptionId\":\"ab3de7bc-7a6e-4e9f-a34a-f6922df453e4\",\"displayName\":\"PrivatestoreTestSubscription\",\"state\":\"Enabled\"}],\"skipToken\":null,\"count\":2}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.Tests.ps1 new file mode 100644 index 000000000000..5cb1e4dfab6c --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.Tests.ps1 @@ -0,0 +1,23 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzMarketplacePrivateStoreAllSubscriptionInTenant')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzMarketplacePrivateStoreAllSubscriptionInTenant' { + It 'Fetch' { + $response = Get-AzMarketplacePrivateStoreAllSubscriptionInTenant -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 + $response | Should -Not -Be $null + $response.value.Count | Should -BeGreaterThan 0 + } +} diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollection.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollection.Recording.json new file mode 100644 index 000000000000..05e153097c39 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollection.Recording.json @@ -0,0 +1,102 @@ +{ + "Get-AzMarketplacePrivateStoreCollection+[NoContext]+List+$GET+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections?api-version=2023-01-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections?api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "10" ], + "x-ms-client-request-id": [ "21157d50-ae32-412d-8235-740cad2028c3" ], + "CommandName": [ "Get-AzMarketplacePrivateStoreCollection" ], + "FullCommandName": [ "Get-AzMarketplacePrivateStoreCollection_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121443Z-un93fkbvw50w5bbm67x1677wk800000009c0000000008ks3" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "8023afec-9edd-4d01-990a-2eea11ecbb8a" ], + "x-ms-correlation-request-id": [ "8023afec-9edd-4d01-990a-2eea11ecbb8a" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121443Z:8023afec-9edd-4d01-990a-2eea11ecbb8a" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: 49579729479B4BF3B1E22B58C9683A39 Ref B: MRS211050313051 Ref C: 2024-02-06T12:14:43Z" ], + "Date": [ "Tue, 06 Feb 2024 12:14:42 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "13472" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":null,\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2021-12-13T13:21:57.3181794Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"name\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":[{\"type\":\"TermsAndCondition\",\"value\":null},{\"type\":\"PrivateProducts\",\"value\":null}],\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"0001-01-01T00:00:00.0000000\",\"collectionId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"collectionName\":\"DefaultCollection\",\"claim\":null,\"allSubscriptions\":true,\"subscriptionsList\":[],\"enabled\":true,\"numberOfOffers\":7}},{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-25T07:11:31.5981395Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-29T10:35:49.4095345Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/d1bb102f-620f-460e-ba55-fdc3856c8fdd\",\"name\":\"d1bb102f-620f-460e-ba55-fdc3856c8fdd\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":null,\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"0001-01-01T00:00:00.0000000\",\"collectionId\":\"d1bb102f-620f-460e-ba55-fdc3856c8fdd\",\"collectionName\":\"BigCollection_DONT_DELETE\",\"claim\":\"\",\"allSubscriptions\":true,\"subscriptionsList\":[],\"enabled\":false,\"numberOfOffers\":308}},{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-16T02:32:40.4982820Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-16T02:32:40.5139194Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/0740a3e6-d5b5-4e22-99be-26887e484fa1\",\"name\":\"0740a3e6-d5b5-4e22-99be-26887e484fa1\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":[{\"type\":\"TermsAndCondition\",\"value\":null}],\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"0001-01-01T00:00:00.0000000\",\"collectionId\":\"0740a3e6-d5b5-4e22-99be-26887e484fa1\",\"collectionName\":\"HyltonTest\",\"claim\":\"\",\"allSubscriptions\":true,\"subscriptionsList\":[],\"enabled\":false,\"numberOfOffers\":8}},{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-17T09:28:59.9603833Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-17T09:28:59.9760039Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/de165278-2dda-40aa-9ce4-15bf37311f49\",\"name\":\"de165278-2dda-40aa-9ce4-15bf37311f49\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":null,\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"0001-01-01T00:00:00.0000000\",\"collectionId\":\"de165278-2dda-40aa-9ce4-15bf37311f49\",\"collectionName\":\"SaviTest2\",\"claim\":\"\",\"allSubscriptions\":true,\"subscriptionsList\":[],\"enabled\":false,\"numberOfOffers\":2}},{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-23T11:06:05.0819718Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-11-20T12:11:11.2082557Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/b411c744-55fd-43b4-b269-faf05d4edae2\",\"name\":\"b411c744-55fd-43b4-b269-faf05d4edae2\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":null,\"approveAllItems\":true,\"approveAllItemsModifiedAt\":\"2023-11-20T12:11:22.3040000Z\",\"collectionId\":\"b411c744-55fd-43b4-b269-faf05d4edae2\",\"collectionName\":\"AllOffers\",\"claim\":\"\",\"allSubscriptions\":false,\"subscriptionsList\":[],\"enabled\":false,\"numberOfOffers\":0}},{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-23T11:07:07.8194410Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-23T11:07:07.8350726Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/dbf8cede-24ff-42c0-b443-3f73df6996f7\",\"name\":\"dbf8cede-24ff-42c0-b443-3f73df6996f7\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":[{\"type\":\"PrivateProducts\",\"value\":null}],\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"0001-01-01T00:00:00.0000000\",\"collectionId\":\"dbf8cede-24ff-42c0-b443-3f73df6996f7\",\"collectionName\":\"RulesCollection\",\"claim\":\"\",\"allSubscriptions\":true,\"subscriptionsList\":[],\"enabled\":false,\"numberOfOffers\":0}},{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-28T11:44:11.7811281Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-28T11:44:11.7967181Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/cf87e6eb-4ed1-44e5-b250-9eb5593b4c0e\",\"name\":\"cf87e6eb-4ed1-44e5-b250-9eb5593b4c0e\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":[{\"type\":\"TermsAndCondition\",\"value\":null},{\"type\":\"PrivateProducts\",\"value\":null}],\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"0001-01-01T00:00:00.0000000\",\"collectionId\":\"cf87e6eb-4ed1-44e5-b250-9eb5593b4c0e\",\"collectionName\":\"TamarTest\",\"claim\":\"\",\"allSubscriptions\":true,\"subscriptionsList\":[],\"enabled\":false,\"numberOfOffers\":10}},{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2023-06-06T10:36:31.3111145Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-06-06T10:36:31.3111145Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/21ea54a6-df79-4dcb-babf-7860b8a82a9c\",\"name\":\"21ea54a6-df79-4dcb-babf-7860b8a82a9c\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":null,\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"0001-01-01T00:00:00.0000000\",\"collectionId\":\"21ea54a6-df79-4dcb-babf-7860b8a82a9c\",\"collectionName\":\"TestCanary\",\"claim\":\"\",\"allSubscriptions\":true,\"subscriptionsList\":[],\"enabled\":false,\"numberOfOffers\":2}},{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2023-06-06T12:36:44.6320854Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-01-01T14:14:04.1461782Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/ac13d584-7c4b-40a6-9d95-7dcf4b79db80\",\"name\":\"ac13d584-7c4b-40a6-9d95-7dcf4b79db80\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":null,\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"2024-01-01T14:14:04.1461782Z\",\"collectionId\":\"ac13d584-7c4b-40a6-9d95-7dcf4b79db80\",\"collectionName\":\"TestBubBash\",\"claim\":\"\",\"allSubscriptions\":false,\"subscriptionsList\":[],\"enabled\":false,\"numberOfOffers\":0}},{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2023-07-10T13:57:40.8477035Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-07-10T13:57:40.8477035Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/73551ecc-d860-407f-9efa-049bab0468f5\",\"name\":\"73551ecc-d860-407f-9efa-049bab0468f5\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":null,\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"0001-01-01T00:00:00.0000000\",\"collectionId\":\"73551ecc-d860-407f-9efa-049bab0468f5\",\"collectionName\":\"PrivatePlans\",\"claim\":\"\",\"allSubscriptions\":true,\"subscriptionsList\":[],\"enabled\":false,\"numberOfOffers\":2}},{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2023-07-26T08:27:39.9228389Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-07-26T08:27:39.9385188Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/22dc7ebe-45b7-4aa6-8c96-a30091344cad\",\"name\":\"22dc7ebe-45b7-4aa6-8c96-a30091344cad\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":null,\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"0001-01-01T00:00:00.0000000\",\"collectionId\":\"22dc7ebe-45b7-4aa6-8c96-a30091344cad\",\"collectionName\":\"bugbashtest\",\"claim\":\"\",\"allSubscriptions\":true,\"subscriptionsList\":[],\"enabled\":false,\"numberOfOffers\":0}},{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2023-07-31T14:31:04.7272779Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-10-29T14:29:34.9057805Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/5b98b8be-7b7f-46fe-8e97-a15ea77dda14\",\"name\":\"5b98b8be-7b7f-46fe-8e97-a15ea77dda14\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":null,\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"2023-10-29T14:29:34.9057805Z\",\"collectionId\":\"5b98b8be-7b7f-46fe-8e97-a15ea77dda14\",\"collectionName\":\"CanaryTest\",\"claim\":\"\",\"allSubscriptions\":false,\"subscriptionsList\":[],\"enabled\":false,\"numberOfOffers\":3}},{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-07T07:04:29.6646906Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-07T07:04:29.6802715Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/65159e59-86c8-4442-b768-2595be217a0f\",\"name\":\"65159e59-86c8-4442-b768-2595be217a0f\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":[{\"type\":\"PrivateProducts\",\"value\":null}],\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"0001-01-01T00:00:00.0000000\",\"collectionId\":\"65159e59-86c8-4442-b768-2595be217a0f\",\"collectionName\":\"LG\",\"claim\":\"\",\"allSubscriptions\":true,\"subscriptionsList\":[],\"enabled\":true,\"numberOfOffers\":1}},{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2024-01-09T11:20:12.9342878Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-01-09T11:20:12.9499426Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/d9b76d86-a3e7-4e9b-befb-3fe5a8d070a6\",\"name\":\"d9b76d86-a3e7-4e9b-befb-3fe5a8d070a6\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":null,\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"0001-01-01T00:00:00.0000000\",\"collectionId\":\"d9b76d86-a3e7-4e9b-befb-3fe5a8d070a6\",\"collectionName\":\"hamzza\",\"claim\":\"\",\"allSubscriptions\":false,\"subscriptionsList\":[],\"enabled\":false,\"numberOfOffers\":1}},{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2024-01-18T09:41:54.8972241Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-01-18T09:41:54.9285122Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/0a4d89f3-8348-4961-9bec-a02780ab8144\",\"name\":\"0a4d89f3-8348-4961-9bec-a02780ab8144\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":[{\"type\":\"PrivateProducts\",\"value\":null}],\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"0001-01-01T00:00:00.0000000\",\"collectionId\":\"0a4d89f3-8348-4961-9bec-a02780ab8144\",\"collectionName\":\"Guy\",\"claim\":\"\",\"allSubscriptions\":true,\"subscriptionsList\":[],\"enabled\":false,\"numberOfOffers\":9}},{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2024-02-05T10:00:08.3151793Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-02-06T12:09:41.5995546Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1\",\"name\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa01f1\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":null,\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"0001-01-01T00:00:00.0000000\",\"collectionId\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa01f1\",\"collectionName\":\"pwshNewCollTest\",\"claim\":null,\"allSubscriptions\":false,\"subscriptionsList\":[],\"enabled\":true,\"numberOfOffers\":2}},{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2024-02-06T12:14:34.5033797Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-02-06T12:14:38.8098396Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188\",\"name\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa0188\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":null,\"approveAllItems\":true,\"approveAllItemsModifiedAt\":\"2024-02-06T12:14:39.9160000Z\",\"collectionId\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa0188\",\"collectionName\":\"AllItemsPWRTest1\",\"claim\":null,\"allSubscriptions\":false,\"subscriptionsList\":[],\"enabled\":false,\"numberOfOffers\":0}},{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2024-02-06T12:14:35.3055425Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-02-06T12:14:35.3211744Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d\",\"name\":\"8c7a91db-cd41-43b6-af47-2e869654126d\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":null,\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"0001-01-01T00:00:00.0000000\",\"collectionId\":\"8c7a91db-cd41-43b6-af47-2e869654126d\",\"collectionName\":\"CopyPWRTest1\",\"claim\":null,\"allSubscriptions\":false,\"subscriptionsList\":[],\"enabled\":false,\"numberOfOffers\":1}}]}", + "isContentBase64": false + } + }, + "Get-AzMarketplacePrivateStoreCollection+[NoContext]+Get+$GET+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6?api-version=2023-01-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6?api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "11" ], + "x-ms-client-request-id": [ "d1cc56dc-4173-4252-a6e3-134d8cf0f6be" ], + "CommandName": [ "Get-AzMarketplacePrivateStoreCollection" ], + "FullCommandName": [ "Get-AzMarketplacePrivateStoreCollection_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121443Z-gwknnxeka10xrfzb2a991aarkg0000000as000000000ap0y" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "24cbc373-1412-4581-b25e-865bc477a0cf" ], + "x-ms-correlation-request-id": [ "24cbc373-1412-4581-b25e-865bc477a0cf" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121443Z:24cbc373-1412-4581-b25e-865bc477a0cf" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: D6D0F5CF3C4C45018C2B4E4C80EE0C95 Ref B: MRS211050313051 Ref C: 2024-02-06T12:14:43Z" ], + "Date": [ "Tue, 06 Feb 2024 12:14:43 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "790" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":null,\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2021-12-13T13:21:57.3181794Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"name\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":[{\"type\":\"TermsAndCondition\",\"value\":null},{\"type\":\"PrivateProducts\",\"value\":null}],\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"0001-01-01T00:00:00.0000000\",\"collectionId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"collectionName\":\"DefaultCollection\",\"claim\":null,\"allSubscriptions\":true,\"subscriptionsList\":[],\"enabled\":true,\"numberOfOffers\":7}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollection.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollection.Tests.ps1 index 6ef20edc46cc..3e4b2806c2db 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollection.Tests.ps1 +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollection.Tests.ps1 @@ -15,15 +15,16 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzMarketplacePrivateStore } Describe 'Get-AzMarketplacePrivateStoreCollection' { - It 'List' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw + It 'List' { + $response = Get-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 + $response | Should -Not -Be $null + $response.Count | Should -BeGreaterThan 0 + $response[0].CollectionId | Should -BeLike "a260d38c-96cf-492d-a340-404d0c4b3ad6" } - It 'Get' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'GetViaIdentity' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw + It 'Get' { + $response = Get-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 + $response | Should -Not -Be $null + $response.CollectionId | Should -BeLike "a260d38c-96cf-492d-a340-404d0c4b3ad6" } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.Recording.json new file mode 100644 index 000000000000..3f432eb007a5 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.Recording.json @@ -0,0 +1,47 @@ +{ + "Get-AzMarketplacePrivateStoreCollectionMapOffersToContext+[NoContext]+ListExpanded+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/mapOffersToContexts?api-version=2023-01-01+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/mapOffersToContexts?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"subscriptionIds\": [ \"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\", \"ab3de7bc-7a6e-4e9f-a34a-f6922df453e4\" ]\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "135" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1193" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121444Z-e9fr18rg4936d7qwr39u9d2ats00000002x0000000007scg" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "815c1ea9-9ce6-4ddc-b6c8-6a3991c08992" ], + "x-ms-correlation-request-id": [ "815c1ea9-9ce6-4ddc-b6c8-6a3991c08992" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121445Z:815c1ea9-9ce6-4ddc-b6c8-6a3991c08992" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: 63452161B12C45AA83583F6F1BC379FD Ref B: MRS211050313051 Ref C: 2024-02-06T12:14:44Z" ], + "Date": [ "Tue, 06 Feb 2024 12:14:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "4773" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"context\":\"00000000-0000-0000-0000-000000000000\",\"offers\":{\"value\":[{\"uniqueOfferId\":\"aumatics.azure_managedservices\",\"offerDisplayName\":\"Aumatics Azure Managed Services\",\"publisherDisplayName\":\"Aumatics\",\"specificPlanIdsLimitation\":null,\"eTag\":\"\\\"c303ee7f-0000-0100-0000-65c0b1020000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"createdAt\":\"2024-02-05T09:57:22.5643444Z\",\"modifiedAt\":\"2024-02-05T09:57:22.5643444Z\",\"plans\":[{\"planId\":\"azure_managedservices_professional\",\"skuId\":\"0001\",\"planDisplayName\":\"Azure Managed Services - Professional\",\"accessibility\":\"Public\",\"altStackReference\":null,\"stackType\":null}],\"iconFileUris\":{\"small\":\"https://store-images.s-microsoft.com/image/apps.28502.8bd414a4-a646-44ba-b745-faf1acee99a2.5610b36b-a1d5-4ed6-a2ec-675fd8b46e6e.6ed46d56-5177-4b3b-b792-d171f21ac71e\",\"medium\":\"https://store-images.s-microsoft.com/image/apps.47342.8bd414a4-a646-44ba-b745-faf1acee99a2.5610b36b-a1d5-4ed6-a2ec-675fd8b46e6e.c4c26433-ca62-4cf7-ba7c-a756fdd8ee51\",\"large\":\"https://store-images.s-microsoft.com/image/apps.63869.8bd414a4-a646-44ba-b745-faf1acee99a2.5610b36b-a1d5-4ed6-a2ec-675fd8b46e6e.acbf0bd7-1405-41ef-8bbb-bf62c04c60e0\"},\"updateSuppressedDueIdempotence\":false}]}},{\"context\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"offers\":{\"value\":[{\"uniqueOfferId\":\"test_test_pmc2pc1.vm_4plans_privatestoretesting\",\"offerDisplayName\":\"Test Base for VM Private Store\",\"publisherDisplayName\":\"Test PMC 2 PC\",\"specificPlanIdsLimitation\":[\"plan3\"],\"eTag\":\"\\\"c503b892-0000-0100-0000-65c0cb150000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"createdAt\":\"2024-02-05T11:48:37.5866264Z\",\"modifiedAt\":\"2024-02-05T11:48:37.6022504Z\",\"plans\":[{\"planId\":\"plan3\",\"skuId\":\"0003\",\"planDisplayName\":\"Plan3\",\"accessibility\":\"Unknown\",\"altStackReference\":null,\"stackType\":null}],\"iconFileUris\":{\"medium\":\"https://store-images.s-microsoft.com/image/apps.47730.e4c872ef-fcba-4287-b5ff-5526c4cee53a.b94f1a28-7936-42c1-b674-8361b5ca9666.e2760c98-3678-47a6-b228-0ca2ec8dea7c\",\"small\":\"https://store-images.s-microsoft.com/image/apps.24616.e4c872ef-fcba-4287-b5ff-5526c4cee53a.b94f1a28-7936-42c1-b674-8361b5ca9666.4eaae684-1741-4d55-8019-e35616172a23\",\"large\":\"https://store-images.s-microsoft.com/image/apps.28795.e4c872ef-fcba-4287-b5ff-5526c4cee53a.b94f1a28-7936-42c1-b674-8361b5ca9666.65b0c4d7-6a12-48d2-8f44-b54c118e19d4\"},\"updateSuppressedDueIdempotence\":false}]}},{\"context\":\"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\",\"offers\":{\"value\":[{\"uniqueOfferId\":\"test_test_pmc2pc1.vm_4plans_privatestoretesting\",\"offerDisplayName\":\"Test Base for VM Private Store\",\"publisherDisplayName\":\"Test PMC 2 PC\",\"specificPlanIdsLimitation\":[\"plan1\"],\"eTag\":\"\\\"c503b892-0000-0100-0000-65c0cb150000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"createdAt\":\"2024-02-05T11:48:37.5866264Z\",\"modifiedAt\":\"2024-02-05T11:48:37.6022504Z\",\"plans\":[{\"planId\":\"plan1\",\"skuId\":\"0001\",\"planDisplayName\":\"Plan1\",\"accessibility\":\"Unknown\",\"altStackReference\":null,\"stackType\":null}],\"iconFileUris\":{\"medium\":\"https://store-images.s-microsoft.com/image/apps.47730.e4c872ef-fcba-4287-b5ff-5526c4cee53a.b94f1a28-7936-42c1-b674-8361b5ca9666.e2760c98-3678-47a6-b228-0ca2ec8dea7c\",\"small\":\"https://store-images.s-microsoft.com/image/apps.24616.e4c872ef-fcba-4287-b5ff-5526c4cee53a.b94f1a28-7936-42c1-b674-8361b5ca9666.4eaae684-1741-4d55-8019-e35616172a23\",\"large\":\"https://store-images.s-microsoft.com/image/apps.28795.e4c872ef-fcba-4287-b5ff-5526c4cee53a.b94f1a28-7936-42c1-b674-8361b5ca9666.65b0c4d7-6a12-48d2-8f44-b54c118e19d4\"},\"updateSuppressedDueIdempotence\":false}]}},{\"context\":\"ab3de7bc-7a6e-4e9f-a34a-f6922df453e4\",\"offers\":{\"value\":[{\"uniqueOfferId\":\"test_test_pmc2pc1.vm_4plans_privatestoretesting\",\"offerDisplayName\":\"Test Base for VM Private Store\",\"publisherDisplayName\":\"Test PMC 2 PC\",\"specificPlanIdsLimitation\":[\"plan2\"],\"eTag\":\"\\\"c503b892-0000-0100-0000-65c0cb150000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"createdAt\":\"2024-02-05T11:48:37.5866264Z\",\"modifiedAt\":\"2024-02-05T11:48:37.6022504Z\",\"plans\":[{\"planId\":\"plan2\",\"skuId\":\"0002\",\"planDisplayName\":\"Plan2\",\"accessibility\":\"Unknown\",\"altStackReference\":null,\"stackType\":null}],\"iconFileUris\":{\"medium\":\"https://store-images.s-microsoft.com/image/apps.47730.e4c872ef-fcba-4287-b5ff-5526c4cee53a.b94f1a28-7936-42c1-b674-8361b5ca9666.e2760c98-3678-47a6-b228-0ca2ec8dea7c\",\"small\":\"https://store-images.s-microsoft.com/image/apps.24616.e4c872ef-fcba-4287-b5ff-5526c4cee53a.b94f1a28-7936-42c1-b674-8361b5ca9666.4eaae684-1741-4d55-8019-e35616172a23\",\"large\":\"https://store-images.s-microsoft.com/image/apps.28795.e4c872ef-fcba-4287-b5ff-5526c4cee53a.b94f1a28-7936-42c1-b674-8361b5ca9666.65b0c4d7-6a12-48d2-8f44-b54c118e19d4\"},\"updateSuppressedDueIdempotence\":false}]}}]}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.Tests.ps1 new file mode 100644 index 000000000000..85361049d92e --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzMarketplacePrivateStoreCollectionMapOffersToContext')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzMarketplacePrivateStoreCollectionMapOffersToContext' { + It 'ListExpanded' { + $response = Get-AzMarketplacePrivateStoreCollectionMapOffersToContext -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionId 1f58b5dd-313c-42ed-84fc-f1e351bba7fb,ab3de7bc-7a6e-4e9f-a34a-f6922df453e4 + $response | Should -Not -Be $null + $response.Count | Should -BeGreaterThan 0 + $response[0].context | Should -BeLike "00000000-0000-0000-0000-000000000000" + } +} diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionOffer.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionOffer.Recording.json index 9a04a2779bda..a578a00f5df2 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionOffer.Recording.json +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionOffer.Recording.json @@ -1,17 +1,17 @@ { - "Get-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+List+$GET+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/offers?api-version=2021-06-01+1": { + "Get-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+List+$GET+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/offers?api-version=2023-01-01+1": { "Request": { "Method": "GET", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/offers?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/offers?api-version=2023-01-01", "Content": null, "isContentBase64": false, "Headers": { - "x-ms-unique-id": [ "5" ], - "x-ms-client-request-id": [ "c3cd6e08-2403-43e1-bae9-a137382d966c" ], + "x-ms-unique-id": [ "13" ], + "x-ms-client-request-id": [ "ee2584b6-020a-4be6-8fd7-959a3153de79" ], "CommandName": [ "Get-AzMarketplacePrivateStoreCollectionOffer" ], "FullCommandName": [ "Get-AzMarketplacePrivateStoreCollectionOffer_List" ], "ParameterSetName": [ "__AllParameterSets" ], - "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], "Authorization": [ "[Filtered]" ] }, "ContentHeaders": { @@ -22,27 +22,30 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11998" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=b115d2f875c66b84b700975954f361f48f95995b3649b85a0990b9141d8b2e7d;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=b115d2f875c66b84b700975954f361f48f95995b3649b85a0990b9141d8b2e7d;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-reads": [ "11999" ], - "x-ms-request-id": [ "555d7d35-2919-42b5-b672-6253d60dd5d4" ], - "x-ms-correlation-request-id": [ "555d7d35-2919-42b5-b672-6253d60dd5d4" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135835Z:555d7d35-2919-42b5-b672-6253d60dd5d4" ], + "x-azure-ref": [ "20240206T121446Z-gwknnxeka10xrfzb2a991aarkg0000000as000000000ap2e" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "effbc9a8-ebfa-4856-b2f9-f7e4f0f2891c" ], + "x-ms-correlation-request-id": [ "effbc9a8-ebfa-4856-b2f9-f7e4f0f2891c" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121446Z:effbc9a8-ebfa-4856-b2f9-f7e4f0f2891c" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:58:34 GMT" ] + "X-MSEdge-Ref": [ "Ref A: 6FEF5CF2C17D4BF4957C4185AD782DE0 Ref B: MRS211050313051 Ref C: 2024-02-06T12:14:46Z" ], + "Date": [ "Tue, 06 Feb 2024 12:14:45 GMT" ] }, "ContentHeaders": { - "Content-Length": [ "3754" ], + "Content-Length": [ "1117" ], "Content-Type": [ "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "Content": "{\"value\":[{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/offers/viacode_consulting-1089577.viacodems\",\"name\":\"viacode_consulting-1089577.viacodems\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"viacode_consulting-1089577.viacodems\",\"specificPlanIdsLimitation\":[\"mgmt-assessment\",\"mgmt-limited-free\"],\"eTag\":\"\\\"6300c3e2-0000-0100-0000-61ded3bf0000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}},{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/offers/apps-4-rent.quickfx-administration\",\"name\":\"apps-4-rent.quickfx-administration\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"apps-4-rent.quickfx-administration\",\"specificPlanIdsLimitation\":[\"quick-fix-administration\"],\"eTag\":\"\\\"0700c8a0-0000-0100-0000-61e90c590000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}},{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/offers/ingrammicro.ingrammicromsp\",\"name\":\"ingrammicro.ingrammicromsp\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"ingrammicro.ingrammicromsp\",\"specificPlanIdsLimitation\":[\"ingrammicromsp\"],\"eTag\":\"\\\"6300b1fd-0000-0100-0000-61ded43c0000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}},{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/offers/checkpoint.vsec\",\"name\":\"checkpoint.vsec\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"checkpoint.vsec\",\"specificPlanIdsLimitation\":null,\"eTag\":\"\\\"6300b1a9-0000-0100-0000-61ded2b10000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}},{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/offers/barracudanetworks.waf\",\"name\":\"barracudanetworks.waf\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"barracudanetworks.waf\",\"specificPlanIdsLimitation\":[\"byol\",\"hourly\"],\"eTag\":\"\\\"6300e7a0-0000-0100-0000-61ded2880000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}},{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/offers/cloudeteer.cdt_cloud-ops\",\"name\":\"cloudeteer.cdt_cloud-ops\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"cloudeteer.cdt_cloud-ops\",\"specificPlanIdsLimitation\":[\"cloud_pro\",\"cloud_go\"],\"eTag\":\"\\\"0700c2a0-0000-0100-0000-61e90c580000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}},{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/offers/aumatics.azure_managedservices\",\"name\":\"aumatics.azure_managedservices\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"aumatics.azure_managedservices\",\"specificPlanIdsLimitation\":[\"azure_managedservices_professional\"],\"eTag\":\"\\\"080019ae-0000-0100-0000-61e92ccb0000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}}]}", + "Content": "{\"value\":[{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/offers/test_test_pmc2pc1.vm_4plans_privatestoretesting\",\"name\":\"test_test_pmc2pc1.vm_4plans_privatestoretesting\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"test_test_pmc2pc1.vm_4plans_privatestoretesting\",\"specificPlanIdsLimitation\":[\"plan3\"],\"eTag\":\"\\\"c503b892-0000-0100-0000-65c0cb150000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}},{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/offers/aumatics.azure_managedservices\",\"name\":\"aumatics.azure_managedservices\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"aumatics.azure_managedservices\",\"specificPlanIdsLimitation\":null,\"eTag\":\"\\\"c303ee7f-0000-0100-0000-65c0b1020000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}}]}", "isContentBase64": false } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 index d937a0c63f6c..c9a597d444ba 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 @@ -16,8 +16,9 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzMarketplacePrivateStore Describe 'Get-AzMarketplacePrivateStoreCollectionOffer' { It 'List' { - - $res = Get-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 - $res.Count | Should -BeGreaterOrEqual 4 -} + $response = Get-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 + $response | Should -Not -Be $null + $response.Count | Should -BeGreaterOrEqual 0 + $response[0].id | Should -Match "a260d38c-96cf-492d-a340-404d0c4b3ad6" + } } \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionRule.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionRule.Recording.json new file mode 100644 index 000000000000..82c36985f248 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionRule.Recording.json @@ -0,0 +1,52 @@ +{ + "Get-AzMarketplacePrivateStoreCollectionRule+[NoContext]+Query+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/queryRules?api-version=2023-01-01+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/queryRules?api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "14" ], + "x-ms-client-request-id": [ "08a84045-6518-432e-9901-7cb03699cfcb" ], + "CommandName": [ "Get-AzMarketplacePrivateStoreCollectionRule" ], + "FullCommandName": [ "Get-AzMarketplacePrivateStoreCollectionRule_Query" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1198" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121447Z-gwknnxeka10xrfzb2a991aarkg0000000as000000000ap2t" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "00de42d9-0d26-49b7-83f5-65373fbf18ce" ], + "x-ms-correlation-request-id": [ "00de42d9-0d26-49b7-83f5-65373fbf18ce" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121447Z:00de42d9-0d26-49b7-83f5-65373fbf18ce" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: E79DEA5AED2D409F820001D5E6A13A4F Ref B: MRS211050313051 Ref C: 2024-02-06T12:14:47Z" ], + "Date": [ "Tue, 06 Feb 2024 12:14:46 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "93" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"type\":\"TermsAndCondition\",\"value\":null},{\"type\":\"PrivateProducts\",\"value\":null}]}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionRule.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionRule.Tests.ps1 new file mode 100644 index 000000000000..1838347bb6b2 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreCollectionRule.Tests.ps1 @@ -0,0 +1,23 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzMarketplacePrivateStoreCollectionRule')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzMarketplacePrivateStoreCollectionRule.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzMarketplacePrivateStoreCollectionRule' { + It 'Query' { + $response = Get-AzMarketplacePrivateStoreCollectionRule -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 + $response | Should -Not -Be $null + $response.Count | Should -BeGreaterOrEqual 0 + } +} diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreNewPlanNotification.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreNewPlanNotification.Recording.json new file mode 100644 index 000000000000..43caf5a06521 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreNewPlanNotification.Recording.json @@ -0,0 +1,52 @@ +{ + "Get-AzMarketplacePrivateStoreNewPlanNotification+[NoContext]+List+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/listNewPlansNotifications?api-version=2023-01-01+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/listNewPlansNotifications?api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "15" ], + "x-ms-client-request-id": [ "241fd7a2-d831-46fc-a727-78cce29f6120" ], + "CommandName": [ "Get-AzMarketplacePrivateStoreNewPlanNotification" ], + "FullCommandName": [ "Get-AzMarketplacePrivateStoreNewPlanNotification_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1192" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121447Z-e9fr18rg4936d7qwr39u9d2ats00000002x0000000007sfh" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "fe7667ba-6731-4122-9f1c-5fc797322039" ], + "x-ms-correlation-request-id": [ "fe7667ba-6731-4122-9f1c-5fc797322039" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121505Z:fe7667ba-6731-4122-9f1c-5fc797322039" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: C5732EA89109404DA4E0FBC4EA6EC2AB Ref B: MRS211050313051 Ref C: 2024-02-06T12:14:47Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:04 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "3564" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"newPlansNotifications\":[{\"offerId\":\"ionqinc1582730893633.ionq-aq\",\"displayName\":\"IonQ Quantum Computer\",\"isFuturePlansEnabled\":false,\"plans\":[{\"planDisplayName\":\"Pay As You Go New (Credits)\",\"planId\":\"aqt-pay-as-you-go-cred\"},{\"planDisplayName\":\"Pay As You Go New\",\"planId\":\"aqt-pay-as-you-go\"}],\"messageCode\":10000,\"icon\":\"https://store-images.s-microsoft.com/image/apps.59976.c625a37e-4a6d-4c8f-94b7-722ec9e77b43.52f31f70-bc4e-4146-88ad-e6d26bd8afbe.6a75b316-f81f-4ed8-be80-abd527d74af7\"},{\"offerId\":\"episerver.optimizely_customer-centric_digital_experience\",\"displayName\":\"Optimizely Customer-Centric Digital Experience\",\"isFuturePlansEnabled\":false,\"plans\":[{\"planDisplayName\":\"Search \u0026 Navigation\",\"planId\":\"05\"}],\"messageCode\":10000,\"icon\":\"https://store-images.s-microsoft.com/image/apps.21006.1ef6fd87-2225-4a0d-ad85-e7c36a1dcbea.1dcac2ec-e9f5-4701-a792-12a50e946495.e45ff0b2-2e40-43cf-ab7b-9392372c898a\"},{\"offerId\":\"haivisionsystemsinc1580780591922.haivision-srt-gateway\",\"displayName\":\"Haivision SRT Gateway\",\"isFuturePlansEnabled\":false,\"plans\":[{\"planDisplayName\":\"Haivision SRT Gateway 3.8.1\",\"planId\":\"srt-gateway-3-8-1-mi\"}],\"messageCode\":10000,\"icon\":\"https://store-images.s-microsoft.com/image/apps.56129.c5d0ccc5-4bcc-48b8-8c6c-5de4db5102d5.cddb8763-605c-4030-a07f-f0fc548f390d.58c6518d-ded9-4bfe-a7e2-5ee09f96645f\"},{\"offerId\":\"haivisionsystemsinc1580780591922.haivision-kraken\",\"displayName\":\"Haivision Kraken Transcoder\",\"isFuturePlansEnabled\":false,\"plans\":[{\"planDisplayName\":\"Haivision Kraken 3.10.0b\",\"planId\":\"hai-kraken-3_10_0b-byol-vm\"},{\"planDisplayName\":\"Haivision Kraken 3.10.1\",\"planId\":\"hai-kraken-3_10_1-byol-vm\"}],\"messageCode\":10000,\"icon\":\"https://store-images.s-microsoft.com/image/apps.4466.475e9d4d-4cbc-4e8b-92e5-1f8a352f5993.f2b7a742-a4cd-4aa2-a654-2c792c40b780.a8bc4595-054d-4936-9e5b-d578fe3f5126\"},{\"offerId\":\"argoscloudsecurity1605618416175.argoscloudsecurity\",\"displayName\":\"ARGOS Cloud Security - modern cloud security diagrams\",\"isFuturePlansEnabled\":false,\"plans\":[{\"planDisplayName\":\"ARGOS for Teams\",\"planId\":\"argosforteams\"}],\"messageCode\":10000,\"icon\":\"https://store-images.s-microsoft.com/image/apps.30662.8f8a2d3c-0167-4dfd-bdc4-6ef8d833e694.66485f74-9342-4e6d-864c-853c10974805.b9e128f8-9efb-407c-809d-43ba2013326f\"},{\"offerId\":\"haivisionsystemsinc1580780591922.haivision-media-gateway\",\"displayName\":\"Haivision Media Gateway\",\"isFuturePlansEnabled\":false,\"plans\":[{\"planDisplayName\":\"Version 3.8.1\",\"planId\":\"hmg-azu-3-8-1-byol-vm\"}],\"messageCode\":10000,\"icon\":\"https://store-images.s-microsoft.com/image/apps.30282.bb1be070-06d5-430d-89d8-87336b5ac843.bca5a4ff-1dcb-4eb6-83a4-3691138691aa.f5e134eb-08eb-4f07-81bb-74c022a7ed8b\"},{\"offerId\":\"postgres-pro.postgres-pro-enterprise-12-vm\",\"displayName\":\"Postgres Pro Enterprise Database 12 (VM)\",\"isFuturePlansEnabled\":false,\"plans\":[{\"planDisplayName\":\"Postgres Pro Enterprise Database 12.17.1 ( AlmaLinux 8)\",\"planId\":\"pgpro-ent12-almalinux8-x64\"}],\"messageCode\":10000,\"icon\":\"https://store-images.s-microsoft.com/image/apps.57093.1b853248-014c-4f64-8f27-d5e47ccc561a.f26b9c44-1d89-41c9-b2e9-4eea8a9c3f03.5a10a1d7-c332-4e1a-8006-f2550884cc63\"},{\"offerId\":\"teradici.hp_anyware\",\"displayName\":\"HP Anyware, formerly Teradici\",\"isFuturePlansEnabled\":false,\"plans\":[{\"planDisplayName\":\"HP Anyware Agent + NVidia GPU + Win11Pro\",\"planId\":\"hp_awa_nvidia_gpu_win11\"}],\"messageCode\":10000,\"icon\":\"https://store-images.s-microsoft.com/image/apps.4755.7cf48e1e-0a26-4c95-bf3f-315bb62002c8.36623ead-5e98-4797-9a23-fcc9f64df455.bebe9396-8b25-4eeb-a6ec-1e4ca22c515a\"}]}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreNewPlanNotification.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreNewPlanNotification.Tests.ps1 new file mode 100644 index 000000000000..686a2a46a475 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreNewPlanNotification.Tests.ps1 @@ -0,0 +1,23 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzMarketplacePrivateStoreNewPlanNotification')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzMarketplacePrivateStoreNewPlanNotification.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzMarketplacePrivateStoreNewPlanNotification' { + It 'List' { + $response = Get-AzMarketplacePrivateStoreNewPlanNotification -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 + $response | Should -Not -Be $null + $response.Count | Should -BeGreaterThan 0 + } +} diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreSubscription.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreSubscription.Recording.json new file mode 100644 index 000000000000..bab1e79d1cec --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreSubscription.Recording.json @@ -0,0 +1,52 @@ +{ + "Get-AzMarketplacePrivateStoreSubscription+[NoContext]+List+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/listSubscriptionsContext?api-version=2023-01-01+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/listSubscriptionsContext?api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "16" ], + "x-ms-client-request-id": [ "707ca8fa-cc1e-4e4c-a208-1155f98d04b6" ], + "CommandName": [ "Get-AzMarketplacePrivateStoreSubscription" ], + "FullCommandName": [ "Get-AzMarketplacePrivateStoreSubscription_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1196" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121505Z-puek9bzdet0fz0hz46rmzq0b5c0000000bhg000000002e3f" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "40232790-ff8b-496f-874f-497879a9771d" ], + "x-ms-correlation-request-id": [ "40232790-ff8b-496f-874f-497879a9771d" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121506Z:40232790-ff8b-496f-874f-497879a9771d" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: 2D3E425518D543A4882FF57BCC87D5D3 Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:05Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:05 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "139" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"subscriptionsIds\":[\"1052ff5a-aa43-4ca1-bd18-010399494ce5\",\"ab3de7bc-7a6e-4e9f-a34a-f6922df453e4\",\"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\"]}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreSubscription.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreSubscription.Tests.ps1 new file mode 100644 index 000000000000..afcc8fe48654 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreSubscription.Tests.ps1 @@ -0,0 +1,23 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzMarketplacePrivateStoreSubscription')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzMarketplacePrivateStoreSubscription.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzMarketplacePrivateStoreSubscription' { + It 'List' { + $response = Get-AzMarketplacePrivateStoreSubscription -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 + $response | Should -Not -Be $null + $response.Count | Should -BeGreaterThan 0 + } +} diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreUserOffer.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreUserOffer.Recording.json new file mode 100644 index 000000000000..dd8afb53cb93 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreUserOffer.Recording.json @@ -0,0 +1,47 @@ +{ + "Get-AzMarketplacePrivateStoreUserOffer+[NoContext]+QueryExpanded+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/queryUserOffers?api-version=2023-01-01+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/queryUserOffers?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"offerIds\": [ \"aumatics.azure_managedservices\" ],\r\n \"subscriptionIds\": [ \"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\" ]\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "150" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1194" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121507Z-8f6r3xskwh4btc8yq2qh5g5fz40000000950000000007at8" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "5a6ee7a7-a32e-4a3c-97c3-33e252f4b1d9" ], + "x-ms-correlation-request-id": [ "5a6ee7a7-a32e-4a3c-97c3-33e252f4b1d9" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121509Z:5a6ee7a7-a32e-4a3c-97c3-33e252f4b1d9" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: B102CFD12D2D443BB82DA25EC67A589A Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:06Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:08 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "274" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"uniqueOfferId\":\"aumatics.azure_managedservices\",\"specificPlanIdsLimitation\":[\"azure_managedservices_professional\"],\"eTag\":\"\\\"c303ee7f-0000-0100-0000-65c0b1020000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}]}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreUserOffer.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreUserOffer.Tests.ps1 new file mode 100644 index 000000000000..2e534e18a761 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreUserOffer.Tests.ps1 @@ -0,0 +1,24 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzMarketplacePrivateStoreUserOffer')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzMarketplacePrivateStoreUserOffer.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzMarketplacePrivateStoreUserOffer' { + It 'QueryExpanded' { + $response = Get-AzMarketplacePrivateStoreUserOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -OfferId aumatics.azure_managedservices -SubscriptionId 1f58b5dd-313c-42ed-84fc-f1e351bba7fb + $response | Should -Not -Be $null + $response.Count | Should -Be 1 + $response[0].uniqueOfferId | Should -Be "aumatics.azure_managedservices" + } +} diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreUserRule.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreUserRule.Recording.json new file mode 100644 index 000000000000..ee5925aaf181 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreUserRule.Recording.json @@ -0,0 +1,47 @@ +{ + "Get-AzMarketplacePrivateStoreUserRule+[NoContext]+QueryExpanded+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/queryUserRules?api-version=2023-01-01+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/queryUserRules?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"subscriptionIds\": [ \"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\" ]\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "95" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1197" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121509Z-un93fkbvw50w5bbm67x1677wk800000009c0000000008me5" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "4da12fda-a76b-4ab1-bb01-4cfaad210264" ], + "x-ms-correlation-request-id": [ "4da12fda-a76b-4ab1-bb01-4cfaad210264" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121510Z:4da12fda-a76b-4ab1-bb01-4cfaad210264" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: D70CAE77926C46B4877610BB88233F35 Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:09Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:09 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "93" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"type\":\"TermsAndCondition\",\"value\":null},{\"type\":\"PrivateProducts\",\"value\":null}]}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreUserRule.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreUserRule.Tests.ps1 new file mode 100644 index 000000000000..52be26b7158a --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreUserRule.Tests.ps1 @@ -0,0 +1,23 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzMarketplacePrivateStoreUserRule')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzMarketplacePrivateStoreUserRule.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzMarketplacePrivateStoreUserRule' { + It 'QueryExpanded' { + $response = Get-AzMarketplacePrivateStoreUserRule -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionId 1f58b5dd-313c-42ed-84fc-f1e351bba7fb + $response | Should -Not -Be $null + $response.Count | Should -BeGreaterThan 0 + } +} diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreV1.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreV1.Recording.json index 1abbc348fb61..58f0f3ebca97 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreV1.Recording.json +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreV1.Recording.json @@ -1,17 +1,17 @@ { - "Get-AzMarketplacePrivateStoreV1+[NoContext]+List+$GET+https://management.azure.com/providers/Microsoft.Marketplace/privateStores?api-version=2021-06-01+1": { + "Get-AzMarketplacePrivateStoreV1+[NoContext]+List+$GET+https://management.azure.com/providers/Microsoft.Marketplace/privateStores?api-version=2023-01-01+1": { "Request": { "Method": "GET", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores?api-version=2023-01-01", "Content": null, "isContentBase64": false, "Headers": { - "x-ms-unique-id": [ "6" ], - "x-ms-client-request-id": [ "8cd64083-31a5-46cb-a322-39fae7a5f562" ], + "x-ms-unique-id": [ "19" ], + "x-ms-client-request-id": [ "f3c9a7a4-0aea-419c-8c78-c237ac717c19" ], "CommandName": [ "Get-AzMarketplacePrivateStoreV1" ], "FullCommandName": [ "Get-AzMarketplacePrivateStoreV1_List" ], "ParameterSetName": [ "__AllParameterSets" ], - "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], "Authorization": [ "[Filtered]" ] }, "ContentHeaders": { @@ -22,27 +22,30 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11997" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=d3888da00a6c22fd6922d241b1e1f8b74760295bc9888c172907d962f5a68055;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=d3888da00a6c22fd6922d241b1e1f8b74760295bc9888c172907d962f5a68055;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-reads": [ "11998" ], - "x-ms-request-id": [ "59edaa8a-c641-4134-b5dc-6c6fbae27e00" ], - "x-ms-correlation-request-id": [ "59edaa8a-c641-4134-b5dc-6c6fbae27e00" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135838Z:59edaa8a-c641-4134-b5dc-6c6fbae27e00" ], + "x-azure-ref": [ "20240206T121510Z-e9fr18rg4936d7qwr39u9d2ats00000002x0000000007t0h" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "a09d8b05-7983-44de-8663-a9cb4558cf47" ], + "x-ms-correlation-request-id": [ "a09d8b05-7983-44de-8663-a9cb4558cf47" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121511Z:a09d8b05-7983-44de-8663-a9cb4558cf47" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:58:37 GMT" ] + "X-MSEdge-Ref": [ "Ref A: 80E8F05A10824BDDBA897B2EFD5C2FDD Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:10Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:10 GMT" ] }, "ContentHeaders": { - "Content-Length": [ "916" ], + "Content-Length": [ "1354" ], "Content-Type": [ "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "Content": "{\"value\":[{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":null,\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-01-24T13:58:17.8941524Z\"},\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"name\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"type\":\"Microsoft.Marketplace/privateStores\",\"properties\":{\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"availability\":\"enabled\",\"eTag\":\"\\\"1e00e7b2-0000-0100-0000-61eeb07a0000\\\"\",\"privateStoreName\":\"Azure\",\"tenantId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"isGov\":false,\"collectionIds\":[\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"8c7a91db-cd41-43b6-af47-2e869654126d\"],\"branding\":{\"newExperience\":\"True\"},\"notificationsSettings\":{\"recipients\":[{\"principalId\":\"48d6cb80-6b16-4f18-9ce3-3a7288080a5b\"},{\"principalId\":\"aa209d7c-8b53-412f-b960-9f64a0f47718\"}],\"sendToAllMarketplaceAdmins\":false}}}]}", + "Content": "{\"value\":[{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":null,\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-02-06T12:14:38.8098396Z\"},\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"name\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"type\":\"Microsoft.Marketplace/privateStores\",\"properties\":{\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"availability\":\"enabled\",\"eTag\":\"\\\"f303e052-0000-0100-0000-65c222af0000\\\"\",\"privateStoreName\":\"Azure\",\"tenantId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"isGov\":false,\"collectionIds\":[\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"d1bb102f-620f-460e-ba55-fdc3856c8fdd\",\"0740a3e6-d5b5-4e22-99be-26887e484fa1\",\"de165278-2dda-40aa-9ce4-15bf37311f49\",\"b411c744-55fd-43b4-b269-faf05d4edae2\",\"dbf8cede-24ff-42c0-b443-3f73df6996f7\",\"cf87e6eb-4ed1-44e5-b250-9eb5593b4c0e\",\"21ea54a6-df79-4dcb-babf-7860b8a82a9c\",\"ac13d584-7c4b-40a6-9d95-7dcf4b79db80\",\"73551ecc-d860-407f-9efa-049bab0468f5\",\"22dc7ebe-45b7-4aa6-8c96-a30091344cad\",\"5b98b8be-7b7f-46fe-8e97-a15ea77dda14\",\"65159e59-86c8-4442-b768-2595be217a0f\",\"d9b76d86-a3e7-4e9b-befb-3fe5a8d070a6\",\"0a4d89f3-8348-4961-9bec-a02780ab8144\",\"fdb889a1-cf3e-49f0-95b8-2bb012fa01f1\",\"fdb889a1-cf3e-49f0-95b8-2bb012fa0188\",\"8c7a91db-cd41-43b6-af47-2e869654126d\"],\"branding\":{\"newExperience\":\"True\"}}}]}", "isContentBase64": false } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreV1.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreV1.Tests.ps1 index c654cff1316a..950c35862d56 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreV1.Tests.ps1 +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplacePrivateStoreV1.Tests.ps1 @@ -17,6 +17,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzMarketplacePrivateStore Describe 'Get-AzMarketplacePrivateStoreV1' { It 'List' { $res = Get-AzMarketplacePrivateStoreV1 - $res.Count | Should -Be 1 + $res.Count | Should -Be 1 + $res[0].privateStoreId | Should -Be "a260d38c-96cf-492d-a340-404d0c4b3ad6" } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceQueryPrivateStoreOffer.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceQueryPrivateStoreOffer.Recording.json index f788a7be0296..351f3e308888 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceQueryPrivateStoreOffer.Recording.json +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceQueryPrivateStoreOffer.Recording.json @@ -1,17 +1,17 @@ { - "Get-AzMarketplaceQueryPrivateStoreOffer+[NoContext]+Query+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/queryOffers?api-version=2021-06-01+1": { + "Get-AzMarketplaceQueryPrivateStoreOffer+[NoContext]+Query+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/queryOffers?api-version=2023-01-01+1": { "Request": { "Method": "POST", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/queryOffers?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/queryOffers?api-version=2023-01-01", "Content": null, "isContentBase64": false, "Headers": { - "x-ms-unique-id": [ "7" ], - "x-ms-client-request-id": [ "954d16ab-d82a-416d-bfce-808c93ace10e" ], + "x-ms-unique-id": [ "20" ], + "x-ms-client-request-id": [ "a5a33f27-fe0f-4069-a684-7227c950aa5d" ], "CommandName": [ "Get-AzMarketplaceQueryPrivateStoreOffer" ], "FullCommandName": [ "Get-AzMarketplaceQueryPrivateStoreOffer_Query" ], "ParameterSetName": [ "__AllParameterSets" ], - "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], "Authorization": [ "[Filtered]" ] }, "ContentHeaders": { @@ -22,27 +22,30 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1197" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=f8b348ab603aeb654affd202b4559f2bcbc3b8205c82a60887bb0f9057a54b31;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=f8b348ab603aeb654affd202b4559f2bcbc3b8205c82a60887bb0f9057a54b31;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-writes": [ "1196" ], - "x-ms-request-id": [ "ee05760f-6b9a-4e2b-ab0a-99ebdaec9213" ], - "x-ms-correlation-request-id": [ "ee05760f-6b9a-4e2b-ab0a-99ebdaec9213" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135843Z:ee05760f-6b9a-4e2b-ab0a-99ebdaec9213" ], + "x-azure-ref": [ "20240206T121511Z-e9fr18rg4936d7qwr39u9d2ats000000030g000000007hys" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "9f54f4e8-1801-43d5-8d1c-0f9a5ec38c0f" ], + "x-ms-correlation-request-id": [ "9f54f4e8-1801-43d5-8d1c-0f9a5ec38c0f" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121512Z:9f54f4e8-1801-43d5-8d1c-0f9a5ec38c0f" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:58:43 GMT" ] + "X-MSEdge-Ref": [ "Ref A: D18C102CDAA146FB822EC1D61F1B75E5 Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:11Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:11 GMT" ] }, "ContentHeaders": { - "Content-Length": [ "1730" ], + "Content-Length": [ "713" ], "Content-Type": [ "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "Content": "{\"value\":[{\"uniqueOfferId\":\"viacode_consulting-1089577.viacodems\",\"specificPlanIdsLimitation\":[\"mgmt-assessment\",\"mgmt-limited-free\"],\"eTag\":\"\\\"6300c3e2-0000-0100-0000-61ded3bf0000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false},{\"uniqueOfferId\":\"apps-4-rent.quickfx-administration\",\"specificPlanIdsLimitation\":[\"quick-fix-administration\"],\"eTag\":\"\\\"0700c8a0-0000-0100-0000-61e90c590000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false},{\"uniqueOfferId\":\"ingrammicro.ingrammicromsp\",\"specificPlanIdsLimitation\":[\"ingrammicromsp\"],\"eTag\":\"\\\"6300b1fd-0000-0100-0000-61ded43c0000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false},{\"uniqueOfferId\":\"checkpoint.vsec\",\"specificPlanIdsLimitation\":null,\"eTag\":\"\\\"6300b1a9-0000-0100-0000-61ded2b10000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false},{\"uniqueOfferId\":\"barracudanetworks.waf\",\"specificPlanIdsLimitation\":[\"byol\",\"hourly\"],\"eTag\":\"\\\"6300e7a0-0000-0100-0000-61ded2880000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false},{\"uniqueOfferId\":\"cloudeteer.cdt_cloud-ops\",\"specificPlanIdsLimitation\":[\"cloud_pro\",\"cloud_go\"],\"eTag\":\"\\\"0700c2a0-0000-0100-0000-61e90c580000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false},{\"uniqueOfferId\":\"aumatics.azure_managedservices\",\"specificPlanIdsLimitation\":[\"azure_managedservices_professional\"],\"eTag\":\"\\\"080019ae-0000-0100-0000-61e92ccb0000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}]}", + "Content": "{\"value\":[{\"uniqueOfferId\":\"test_test_pmc2pc1.vm_4plans_privatestoretesting\",\"specificPlanIdsLimitation\":[\"plan3\"],\"eTag\":\"\\\"c503b892-0000-0100-0000-65c0cb150000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false},{\"uniqueOfferId\":\"sendgrid.tsg-saas-offer\",\"specificPlanIdsLimitation\":null,\"eTag\":\"\\\"f3032232-0000-0100-0000-65c221910000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false},{\"uniqueOfferId\":\"aumatics.azure_managedservices\",\"specificPlanIdsLimitation\":null,\"eTag\":\"\\\"c303ee7f-0000-0100-0000-65c0b1020000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}]}", "isContentBase64": false } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceQueryPrivateStoreOffer.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceQueryPrivateStoreOffer.Tests.ps1 index 5a32a2c77afd..5f86a78f9e44 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceQueryPrivateStoreOffer.Tests.ps1 +++ b/src/Marketplace/Marketplace.Autorest/test/Get-AzMarketplaceQueryPrivateStoreOffer.Tests.ps1 @@ -16,8 +16,8 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzMarketplaceQueryPrivate Describe 'Get-AzMarketplaceQueryPrivateStoreOffer' { It 'Query' { - $res = Get-AzMarketplaceQueryPrivateStoreOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 - $res.Count | Should -BeGreaterOrEqual 2 + $res = Get-AzMarketplaceQueryPrivateStoreOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 + $res.Count | Should -BeGreaterOrEqual 0 } } diff --git a/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollection.Recording.json b/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollection.Recording.json index 9f5d9a6814ce..bb95547c7b93 100644 --- a/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollection.Recording.json +++ b/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollection.Recording.json @@ -1,15 +1,15 @@ { - "New-AzMarketplacePrivateStoreCollection+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1?api-version=2021-06-01+1": { + "New-AzMarketplacePrivateStoreCollection+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1?api-version=2023-01-01+1": { "Request": { "Method": "PUT", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1?api-version=2021-06-01", - "Content": "{\n \"properties\": {\n \"collectionName\": \"test187\",\n \"subscriptionsList\": [ \"1052ff5a-aa43-4ca1-bd18-010399494ce5\" ]\n }\n}", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"collectionName\": \"pwshNewCollTest\",\r\n \"subscriptionsList\": [ \"1052ff5a-aa43-4ca1-bd18-010399494ce5\" ],\r\n \"enabled\": true\r\n }\r\n}", "isContentBase64": false, "Headers": { }, "ContentHeaders": { "Content-Type": [ "application/json" ], - "Content-Length": [ "126" ] + "Content-Length": [ "161" ] } }, "Response": { @@ -17,27 +17,30 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1199" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=92773f2c1c67026ec4d9126bfcf778845d6357a27b8781ad374bcfa850a3111a;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=92773f2c1c67026ec4d9126bfcf778845d6357a27b8781ad374bcfa850a3111a;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-writes": [ "1198" ], - "x-ms-request-id": [ "024d5ecf-b300-4788-8615-0ed460a84d52" ], - "x-ms-correlation-request-id": [ "024d5ecf-b300-4788-8615-0ed460a84d52" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135850Z:024d5ecf-b300-4788-8615-0ed460a84d52" ], + "x-azure-ref": [ "20240206T121513Z-e9fr18rg4936d7qwr39u9d2ats000000030g000000007hzu" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "f6d1f15e-10ad-417a-bb67-4246106443c1" ], + "x-ms-correlation-request-id": [ "f6d1f15e-10ad-417a-bb67-4246106443c1" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121513Z:f6d1f15e-10ad-417a-bb67-4246106443c1" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:58:49 GMT" ] + "X-MSEdge-Ref": [ "Ref A: D2CEC17030EA4604B1C88530AED4345E Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:13Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:12 GMT" ] }, "ContentHeaders": { - "Content-Length": [ "665" ], + "Content-Length": [ "672" ], "Content-Type": [ "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2022-01-24T13:58:49.8275436Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-01-24T13:58:49.8525390Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1\",\"name\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa01f1\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"collectionId\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa01f1\",\"collectionName\":\"test187\",\"claim\":null,\"allSubscriptions\":false,\"subscriptionsList\":[\"1052ff5a-aa43-4ca1-bd18-010399494ce5\"],\"enabled\":false,\"numberOfOffers\":0}}", + "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2024-02-05T10:00:08.3151793Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-02-06T12:15:13.4534122Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1\",\"name\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa01f1\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"collectionId\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa01f1\",\"collectionName\":\"pwshNewCollTest\",\"claim\":null,\"allSubscriptions\":false,\"subscriptionsList\":[\"1052ff5a-aa43-4ca1-bd18-010399494ce5\"],\"enabled\":true,\"numberOfOffers\":0}}", "isContentBase64": false } } diff --git a/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollection.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollection.Tests.ps1 index da4aef0d467b..31af85fbcd44 100644 --- a/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollection.Tests.ps1 +++ b/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollection.Tests.ps1 @@ -16,7 +16,9 @@ if(($null -eq $TestName) -or ($TestName -contains 'New-AzMarketplacePrivateStore Describe 'New-AzMarketplacePrivateStoreCollection' { It 'CreateExpanded' { - $res = New-AzMarketplacePrivateStoreCollection -CollectionName test187 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionsList 1052ff5a-aa43-4ca1-bd18-010399494ce5 - $res.CollectionId | Should -Be "fdb889a1-cf3e-49f0-95b8-2bb012fa01f1" + $res = New-AzMarketplacePrivateStoreCollection -CollectionName pwshNewCollTest -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionsList 1052ff5a-aa43-4ca1-bd18-010399494ce5 -Enabled + $res.CollectionId | Should -Be "fdb889a1-cf3e-49f0-95b8-2bb012fa01f1" + $res.CollectionName | Should -Be "pwshNewCollTest" + $res.enabled | Should -Be "true" } } diff --git a/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollectionOffer.Recording.json b/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollectionOffer.Recording.json index 2cb8ff20f1a5..1dd04258c079 100644 --- a/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollectionOffer.Recording.json +++ b/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollectionOffer.Recording.json @@ -1,15 +1,15 @@ { - "New-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1/offers/aumatics.azure_managedservices?api-version=2021-06-01+1": { + "New-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/offers/aumatics.azure_managedservices?api-version=2023-01-01+1": { "Request": { "Method": "PUT", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1/offers/aumatics.azure_managedservices?api-version=2021-06-01", - "Content": "{\n \"properties\": {\n \"plans\": [\n {\n \"accessibility\": \"azure_managedservices_professional\"\n }\n ]\n }\n}", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/offers/aumatics.azure_managedservices?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"plans\": [\r\n {\r\n \"accessibility\": \"azure_managedservices_professional\"\r\n }\r\n ]\r\n }\r\n}", "isContentBase64": false, "Headers": { }, "ContentHeaders": { "Content-Type": [ "application/json" ], - "Content-Length": [ "124" ] + "Content-Length": [ "132" ] } }, "Response": { @@ -17,27 +17,30 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1198" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=b115d2f875c66b84b700975954f361f48f95995b3649b85a0990b9141d8b2e7d;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=b115d2f875c66b84b700975954f361f48f95995b3649b85a0990b9141d8b2e7d;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-writes": [ "1197" ], - "x-ms-request-id": [ "693e8da5-2893-400c-bd15-6fe7f770b1e2" ], - "x-ms-correlation-request-id": [ "693e8da5-2893-400c-bd15-6fe7f770b1e2" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135854Z:693e8da5-2893-400c-bd15-6fe7f770b1e2" ], + "x-azure-ref": [ "20240206T121514Z-e9fr18rg4936d7qwr39u9d2ats000000030g000000007k0b" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "e9712d61-db75-4a65-a6bd-16ce4a07d523" ], + "x-ms-correlation-request-id": [ "e9712d61-db75-4a65-a6bd-16ce4a07d523" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121514Z:e9712d61-db75-4a65-a6bd-16ce4a07d523" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:58:53 GMT" ] + "X-MSEdge-Ref": [ "Ref A: 8081009FD2104237B33CB15E77BAA15E Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:14Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:13 GMT" ] }, "ContentHeaders": { - "Content-Length": [ "524" ], + "Content-Length": [ "523" ], "Content-Type": [ "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "Content": "{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1/offers/aumatics.azure_managedservices\",\"name\":\"aumatics.azure_managedservices\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"aumatics.azure_managedservices\",\"specificPlanIdsLimitation\":null,\"eTag\":\"\\\"1e0016b6-0000-0100-0000-61eeb09d0000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}}", + "Content": "{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/a260d38c-96cf-492d-a340-404d0c4b3ad6/offers/aumatics.azure_managedservices\",\"name\":\"aumatics.azure_managedservices\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"aumatics.azure_managedservices\",\"specificPlanIdsLimitation\":null,\"eTag\":\"\\\"c303ee7f-0000-0100-0000-65c0b1020000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":true}}", "isContentBase64": false } } diff --git a/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 index ecc3ca172434..32183458d0d8 100644 --- a/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 +++ b/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 @@ -17,7 +17,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'New-AzMarketplacePrivateStore Describe 'New-AzMarketplacePrivateStoreCollectionOffer' { It 'CreateExpanded' { $acc = @{Accessibility = "azure_managedservices_professional"} - $res = New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -OfferId aumatics.azure_managedservices -Plan $acc - $res.UniqueOfferId | Should -be "aumatics.azure_managedservices" + $res = New-AzMarketplacePrivateStoreCollectionOffer -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -OfferId aumatics.azure_managedservices -Plan $acc + $res.UniqueOfferId | Should -be "aumatics.azure_managedservices" } } diff --git a/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollectionOfferMultiContext.Recording.json b/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollectionOfferMultiContext.Recording.json new file mode 100644 index 000000000000..5e44965215e3 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollectionOfferMultiContext.Recording.json @@ -0,0 +1,92 @@ +{ + "New-AzMarketplacePrivateStoreCollectionOfferMultiContext+[NoContext]+OfferExpanded+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1/offers/test_test_pmc2pc1.vm_4plans_privatestoretesting/upsertOfferWithMultiContext?api-version=2023-01-01+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1/offers/test_test_pmc2pc1.vm_4plans_privatestoretesting/upsertOfferWithMultiContext?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"plansContext\": [\r\n {\r\n \"context\": \"1f58b5dd-313c-42ed-84fc-f1e351bba7fb\",\r\n \"planIds\": [ \"plan1\" ]\r\n },\r\n {\r\n \"context\": \"ab3de7bc-7a6e-4e9f-a34a-f6922df453e4\",\r\n \"planIds\": [ \"plan2\" ]\r\n },\r\n {\r\n \"context\": \"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\r\n \"planIds\": [ \"plan3\" ]\r\n }\r\n ]\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "390" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1191" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121515Z-e9fr18rg4936d7qwr39u9d2ats00000002x0000000007t2x" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "ee5316f5-c596-4eec-9dc2-3f3ae1a9940d" ], + "x-ms-correlation-request-id": [ "ee5316f5-c596-4eec-9dc2-3f3ae1a9940d" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121516Z:ee5316f5-c596-4eec-9dc2-3f3ae1a9940d" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: ED715971A92D4756932219CE66117F24 Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:15Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:15 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "596" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1/offers/test_test_pmc2pc1.vm_4plans_privatestoretesting\",\"name\":\"test_test_pmc2pc1.vm_4plans_privatestoretesting\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"test_test_pmc2pc1.vm_4plans_privatestoretesting\",\"specificPlanIdsLimitation\":[\"plan3\",\"plan1\",\"plan2\"],\"eTag\":\"\\\"f303fd56-0000-0100-0000-65c222d40000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}}", + "isContentBase64": false + } + }, + "New-AzMarketplacePrivateStoreCollectionOfferMultiContext+[NoContext]+OfferExpanded+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1/offers/sendgrid.tsg-saas-offer/upsertOfferWithMultiContext?api-version=2023-01-01+2": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1/offers/sendgrid.tsg-saas-offer/upsertOfferWithMultiContext?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"plansContext\": [\r\n {\r\n \"context\": \"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\r\n \"planIds\": [ \"pro-100k\", \"pro-300k\" ]\r\n }\r\n ]\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "183" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1196" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121516Z-e9fr18rg4936d7qwr39u9d2ats000000030g000000007k24" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "a9e82b69-dc32-4dcd-be92-ffb7aa3c9761" ], + "x-ms-correlation-request-id": [ "a9e82b69-dc32-4dcd-be92-ffb7aa3c9761" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121516Z:a9e82b69-dc32-4dcd-be92-ffb7aa3c9761" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: D86591A8E96143B88EAE97BF9A16AA99 Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:16Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "522" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1/offers/sendgrid.tsg-saas-offer\",\"name\":\"sendgrid.tsg-saas-offer\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"sendgrid.tsg-saas-offer\",\"specificPlanIdsLimitation\":[\"pro-100k\",\"pro-300k\"],\"eTag\":\"\\\"f3031757-0000-0100-0000-65c222d40000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollectionOfferMultiContext.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollectionOfferMultiContext.Tests.ps1 new file mode 100644 index 000000000000..3beaa46cc4ca --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/New-AzMarketplacePrivateStoreCollectionOfferMultiContext.Tests.ps1 @@ -0,0 +1,49 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzMarketplacePrivateStoreCollectionOfferMultiContext')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzMarketplacePrivateStoreCollectionOfferMultiContext.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +$private1 = @{ + context = "1f58b5dd-313c-42ed-84fc-f1e351bba7fb" + planId = "plan1" +} +$private2 = @{ + context = "ab3de7bc-7a6e-4e9f-a34a-f6922df453e4" + planId = "plan2" +} +$private3 = @{ + context = "a260d38c-96cf-492d-a340-404d0c4b3ad6" + planId = "plan3" +} +$private = @($private1, $private2, $private3) + +$public1 = @{ + context = "a260d38c-96cf-492d-a340-404d0c4b3ad6" + planId = "pro-100k","pro-300k" +} +$public = @($public1) + +Describe 'New-AzMarketplacePrivateStoreCollectionOfferMultiContext' { + It 'OfferExpanded' { + $res = New-AzMarketplacePrivateStoreCollectionOfferMultiContext -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -OfferId test_test_pmc2pc1.vm_4plans_privatestoretesting -PlansContext $private + $res | Should -Not -Be $null + $res.name | Should -Be 'test_test_pmc2pc1.vm_4plans_privatestoretesting' + $res.specificPlanIdsLimitation.Count | Should -Be 3 + + $res = New-AzMarketplacePrivateStoreCollectionOfferMultiContext -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -OfferId sendgrid.tsg-saas-offer -PlansContext $public + $res | Should -Not -Be $null + $res.name | Should -Be 'sendgrid.tsg-saas-offer' + $res.specificPlanIdsLimitation.Count | Should -Be 2 + } +} diff --git a/src/Marketplace/Marketplace.Autorest/test/Remove-AzMarketplacePrivateStoreCollection.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Remove-AzMarketplacePrivateStoreCollection.Recording.json index 8608ca7eae3e..fe6b741a1e6f 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Remove-AzMarketplacePrivateStoreCollection.Recording.json +++ b/src/Marketplace/Marketplace.Autorest/test/Remove-AzMarketplacePrivateStoreCollection.Recording.json @@ -1,15 +1,15 @@ { - "Remove-AzMarketplacePrivateStoreCollection+[NoContext]+Delete+$PUT+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f2?api-version=2021-06-01+1": { + "Remove-AzMarketplacePrivateStoreCollection+[NoContext]+Delete+$PUT+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f2?api-version=2023-01-01+1": { "Request": { "Method": "PUT", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f2?api-version=2021-06-01", - "Content": "{\n \"properties\": {\n \"collectionName\": \"collectionToDelete\",\n \"subscriptionsList\": [ \"1052ff5a-aa43-4ca1-bd18-010399494ce5\" ]\n }\n}", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f2?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"collectionName\": \"collectionToDelete\",\r\n \"subscriptionsList\": [ \"1052ff5a-aa43-4ca1-bd18-010399494ce5\" ]\r\n }\r\n}", "isContentBase64": false, "Headers": { }, "ContentHeaders": { "Content-Type": [ "application/json" ], - "Content-Length": [ "137" ] + "Content-Length": [ "142" ] } }, "Response": { @@ -17,43 +17,46 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1197" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=b166a90e62456752594f81d91d3a0138a0972c9ace2eaf27fb2e4f52b791ce2d;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=b166a90e62456752594f81d91d3a0138a0972c9ace2eaf27fb2e4f52b791ce2d;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-writes": [ "1196" ], - "x-ms-request-id": [ "130e9d6d-04a5-472f-90e4-02a84d836560" ], - "x-ms-correlation-request-id": [ "130e9d6d-04a5-472f-90e4-02a84d836560" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135901Z:130e9d6d-04a5-472f-90e4-02a84d836560" ], + "x-azure-ref": [ "20240206T121517Z-gwknnxeka10xrfzb2a991aarkg0000000as000000000aqb5" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "bff7f796-a797-415a-af53-c0db11cf2a9a" ], + "x-ms-correlation-request-id": [ "bff7f796-a797-415a-af53-c0db11cf2a9a" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121517Z:bff7f796-a797-415a-af53-c0db11cf2a9a" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:59:00 GMT" ] + "X-MSEdge-Ref": [ "Ref A: 8B033EC9989B435BBEAB662EF8F18EAD Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:17Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:16 GMT" ] }, "ContentHeaders": { "Content-Length": [ "676" ], "Content-Type": [ "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2022-01-24T13:59:01.0244241Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-01-24T13:59:01.0444893Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f2\",\"name\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa01f2\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"collectionId\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa01f2\",\"collectionName\":\"collectionToDelete\",\"claim\":null,\"allSubscriptions\":false,\"subscriptionsList\":[\"1052ff5a-aa43-4ca1-bd18-010399494ce5\"],\"enabled\":false,\"numberOfOffers\":0}}", + "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2024-02-06T12:15:17.4923256Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-02-06T12:15:17.5079514Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f2\",\"name\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa01f2\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"collectionId\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa01f2\",\"collectionName\":\"collectionToDelete\",\"claim\":null,\"allSubscriptions\":false,\"subscriptionsList\":[\"1052ff5a-aa43-4ca1-bd18-010399494ce5\"],\"enabled\":false,\"numberOfOffers\":0}}", "isContentBase64": false } }, - "Remove-AzMarketplacePrivateStoreCollection+[NoContext]+Delete+$DELETE+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f2?api-version=2021-06-01+2": { + "Remove-AzMarketplacePrivateStoreCollection+[NoContext]+Delete+$DELETE+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f2?api-version=2023-01-01+2": { "Request": { "Method": "DELETE", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f2?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f2?api-version=2023-01-01", "Content": null, "isContentBase64": false, "Headers": { - "x-ms-unique-id": [ "11" ], - "x-ms-client-request-id": [ "8e49d379-6fc9-4160-afe3-a8ecb8c951e5" ], + "x-ms-unique-id": [ "26" ], + "x-ms-client-request-id": [ "71ac195d-5da7-4ee0-94bc-b10ea154eca6" ], "CommandName": [ "Remove-AzMarketplacePrivateStoreCollection" ], "FullCommandName": [ "Remove-AzMarketplacePrivateStoreCollection_Delete" ], "ParameterSetName": [ "__AllParameterSets" ], - "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], "Authorization": [ "[Filtered]" ] }, "ContentHeaders": { @@ -64,19 +67,22 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Set-Cookie": [ "ARRAffinity=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-deletes": [ "14999" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=d3888da00a6c22fd6922d241b1e1f8b74760295bc9888c172907d962f5a68055;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=d3888da00a6c22fd6922d241b1e1f8b74760295bc9888c172907d962f5a68055;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-deletes": [ "14999" ], - "x-ms-request-id": [ "05f35b4d-0ee1-4e37-ba70-0cd43f56beab" ], - "x-ms-correlation-request-id": [ "05f35b4d-0ee1-4e37-ba70-0cd43f56beab" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135902Z:05f35b4d-0ee1-4e37-ba70-0cd43f56beab" ], + "x-azure-ref": [ "20240206T121517Z-un93fkbvw50w5bbm67x1677wk800000009c0000000008mq4" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "24a85f44-1777-4b57-8140-a03ce80c9928" ], + "x-ms-correlation-request-id": [ "24a85f44-1777-4b57-8140-a03ce80c9928" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121518Z:24a85f44-1777-4b57-8140-a03ce80c9928" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:59:01 GMT" ] + "X-MSEdge-Ref": [ "Ref A: 4ED3086D087D49C4A90FDB54FA3EC82A Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:17Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:17 GMT" ] }, "ContentHeaders": { "Expires": [ "-1" ], @@ -86,19 +92,19 @@ "isContentBase64": false } }, - "Remove-AzMarketplacePrivateStoreCollection+[NoContext]+Delete+$GET+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f2?api-version=2021-06-01+3": { + "Remove-AzMarketplacePrivateStoreCollection+[NoContext]+Delete+$GET+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f2?api-version=2023-01-01+3": { "Request": { "Method": "GET", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f2?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f2?api-version=2023-01-01", "Content": null, "isContentBase64": false, "Headers": { - "x-ms-unique-id": [ "12" ], - "x-ms-client-request-id": [ "fb3d85a3-14d0-4ead-93b6-e4a04142fb4c" ], + "x-ms-unique-id": [ "27" ], + "x-ms-client-request-id": [ "11ea66c8-8c32-4b3a-a5ef-1f09b1166e39" ], "CommandName": [ "Get-AzMarketplacePrivateStoreCollection" ], "FullCommandName": [ "Get-AzMarketplacePrivateStoreCollection_Get" ], "ParameterSetName": [ "__AllParameterSets" ], - "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], "Authorization": [ "[Filtered]" ] }, "ContentHeaders": { @@ -109,19 +115,21 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Set-Cookie": [ "ARRAffinity=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11997" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=f8b348ab603aeb654affd202b4559f2bcbc3b8205c82a60887bb0f9057a54b31;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=f8b348ab603aeb654affd202b4559f2bcbc3b8205c82a60887bb0f9057a54b31;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-reads": [ "11997" ], - "x-ms-request-id": [ "ac4a58fa-9b7d-454c-bd95-c09687189804" ], - "x-ms-correlation-request-id": [ "ac4a58fa-9b7d-454c-bd95-c09687189804" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135902Z:ac4a58fa-9b7d-454c-bd95-c09687189804" ], + "x-azure-ref": [ "20240206T121518Z-puek9bzdet0fz0hz46rmzq0b5c0000000bhg000000002ea0" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "89219618-87bf-4339-9977-d9a0905ff3a5" ], + "x-ms-correlation-request-id": [ "89219618-87bf-4339-9977-d9a0905ff3a5" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121518Z:89219618-87bf-4339-9977-d9a0905ff3a5" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:59:01 GMT" ] + "X-MSEdge-Ref": [ "Ref A: D2466196CCF742FEBEA93BE7B70243EB Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:18Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:17 GMT" ] }, "ContentHeaders": { "Expires": [ "-1" ], diff --git a/src/Marketplace/Marketplace.Autorest/test/Remove-AzMarketplacePrivateStoreCollection.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Remove-AzMarketplacePrivateStoreCollection.Tests.ps1 index c290f1cef4a1..fd8866612a26 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Remove-AzMarketplacePrivateStoreCollection.Tests.ps1 +++ b/src/Marketplace/Marketplace.Autorest/test/Remove-AzMarketplacePrivateStoreCollection.Tests.ps1 @@ -17,8 +17,8 @@ if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzMarketplacePrivateSt Describe 'Remove-AzMarketplacePrivateStoreCollection' { It 'Delete' { New-AzMarketplacePrivateStoreCollection -CollectionName collectionToDelete -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f2 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionsList 1052ff5a-aa43-4ca1-bd18-010399494ce5 - Remove-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f2 - try{Get-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f2} catch {$Error[0] | Should -Match "NotFound"} + Remove-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f2 + try{Get-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f2} catch {$Error[0] | Should -Match "NotFound"} } diff --git a/src/Marketplace/Marketplace.Autorest/test/Remove-AzMarketplacePrivateStoreCollectionOffer.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Remove-AzMarketplacePrivateStoreCollectionOffer.Recording.json index b4228306debc..bb1e2b76871c 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Remove-AzMarketplacePrivateStoreCollectionOffer.Recording.json +++ b/src/Marketplace/Marketplace.Autorest/test/Remove-AzMarketplacePrivateStoreCollectionOffer.Recording.json @@ -1,17 +1,17 @@ { - "Remove-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+Delete+$DELETE+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1/offers/aumatics.azure_managedservices?api-version=2021-06-01+1": { + "Remove-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+Delete+$DELETE+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1/offers/aumatics.azure_managedservices?api-version=2023-01-01+1": { "Request": { "Method": "DELETE", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1/offers/aumatics.azure_managedservices?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1/offers/aumatics.azure_managedservices?api-version=2023-01-01", "Content": null, "isContentBase64": false, "Headers": { - "x-ms-unique-id": [ "13" ], - "x-ms-client-request-id": [ "31d2d61f-6e47-4118-8621-c4e09af24f7a" ], + "x-ms-unique-id": [ "28" ], + "x-ms-client-request-id": [ "aeef3aad-66c0-4bbc-b61d-0683b9d197ec" ], "CommandName": [ "Remove-AzMarketplacePrivateStoreCollectionOffer" ], "FullCommandName": [ "Remove-AzMarketplacePrivateStoreCollectionOffer_Delete" ], "ParameterSetName": [ "__AllParameterSets" ], - "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], "Authorization": [ "[Filtered]" ] }, "ContentHeaders": { @@ -22,19 +22,22 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Set-Cookie": [ "ARRAffinity=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-deletes": [ "14998" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=ac34b1a047b7a77113a516ef142ac6ff661eaaf7884099e34431a940426d41cc;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=ac34b1a047b7a77113a516ef142ac6ff661eaaf7884099e34431a940426d41cc;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-deletes": [ "14998" ], - "x-ms-request-id": [ "81058a07-c121-4e25-882f-394b959a07f4" ], - "x-ms-correlation-request-id": [ "81058a07-c121-4e25-882f-394b959a07f4" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135906Z:81058a07-c121-4e25-882f-394b959a07f4" ], + "x-azure-ref": [ "20240206T121518Z-e9fr18rg4936d7qwr39u9d2ats000000030g000000007k4m" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "e6b91b98-50a3-447e-8373-de634bb9a2ed" ], + "x-ms-correlation-request-id": [ "e6b91b98-50a3-447e-8373-de634bb9a2ed" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121519Z:e6b91b98-50a3-447e-8373-de634bb9a2ed" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:59:05 GMT" ] + "X-MSEdge-Ref": [ "Ref A: 67DC9E1325E14110929E6A3695AEA01A Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:18Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:18 GMT" ] }, "ContentHeaders": { "Expires": [ "-1" ], @@ -44,19 +47,19 @@ "isContentBase64": false } }, - "Remove-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+Delete+$GET+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1/offers/aumatics.azure_managedservices?api-version=2021-06-01+2": { + "Remove-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+Delete+$GET+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1/offers/aumatics.azure_managedservices?api-version=2023-01-01+2": { "Request": { "Method": "GET", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1/offers/aumatics.azure_managedservices?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa01f1/offers/aumatics.azure_managedservices?api-version=2023-01-01", "Content": null, "isContentBase64": false, "Headers": { - "x-ms-unique-id": [ "14" ], - "x-ms-client-request-id": [ "de213ed4-ecb5-4f0e-95f1-ab093eed051a" ], + "x-ms-unique-id": [ "29" ], + "x-ms-client-request-id": [ "23ecf0bd-4d81-46c9-adb8-708cbb52c3b3" ], "CommandName": [ "Get-AzMarketplacePrivateStoreCollectionOffer" ], "FullCommandName": [ "Get-AzMarketplacePrivateStoreCollectionOffer_Get" ], "ParameterSetName": [ "__AllParameterSets" ], - "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], "Authorization": [ "[Filtered]" ] }, "ContentHeaders": { @@ -67,19 +70,21 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Set-Cookie": [ "ARRAffinity=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11998" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=b04ffa86539d7689519d8eb5d5e7423177e93a8afca318b1f76e4c8444a7d2a2;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=b04ffa86539d7689519d8eb5d5e7423177e93a8afca318b1f76e4c8444a7d2a2;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-reads": [ "11996" ], - "x-ms-request-id": [ "c77c861f-baf3-4139-aef2-748e816655a9" ], - "x-ms-correlation-request-id": [ "c77c861f-baf3-4139-aef2-748e816655a9" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135906Z:c77c861f-baf3-4139-aef2-748e816655a9" ], + "x-azure-ref": [ "20240206T121519Z-e9fr18rg4936d7qwr39u9d2ats000000030g000000007k4z" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "9d4baabb-6155-4f8e-9ebf-1fcd15da380d" ], + "x-ms-correlation-request-id": [ "9d4baabb-6155-4f8e-9ebf-1fcd15da380d" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121519Z:9d4baabb-6155-4f8e-9ebf-1fcd15da380d" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:59:05 GMT" ] + "X-MSEdge-Ref": [ "Ref A: C30BD4EC846D4F7C85B5A03C26CBDFA5 Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:19Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:18 GMT" ] }, "ContentHeaders": { "Content-Length": [ "95" ], diff --git a/src/Marketplace/Marketplace.Autorest/test/Remove-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Remove-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 index 93889d482148..0c25770d24f4 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Remove-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 +++ b/src/Marketplace/Marketplace.Autorest/test/Remove-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 @@ -16,11 +16,13 @@ if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzMarketplacePrivateSt Describe 'Remove-AzMarketplacePrivateStoreCollectionOffer' { It 'Delete' { - Remove-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -OfferId aumatics.azure_managedservices - - try{Get-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -OfferId aumatics.azure_managedservices} catch {$Error[0] | Should -Match "aumatics.azure_managedservices does not exist"} - - } - - + Remove-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -OfferId aumatics.azure_managedservices + try { + Get-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -OfferId aumatics.azure_managedservices + } + catch { + <#Do this if a terminating exception happens#> + $Error[0] | Should -Match "aumatics.azure_managedservices does not exist" + } + } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplaceBulkPrivateStoreCollectionAction.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplaceBulkPrivateStoreCollectionAction.Recording.json index 13397f65cac5..b7662f9424fd 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplaceBulkPrivateStoreCollectionAction.Recording.json +++ b/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplaceBulkPrivateStoreCollectionAction.Recording.json @@ -1,15 +1,15 @@ { - "Set-AzMarketplaceBulkPrivateStoreCollectionAction+[NoContext]+BulkExpanded+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/bulkCollectionsAction?api-version=2021-06-01+1": { + "Set-AzMarketplaceBulkPrivateStoreCollectionAction+[NoContext]+BulkExpanded+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/bulkCollectionsAction?api-version=2023-01-01+1": { "Request": { "Method": "POST", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/bulkCollectionsAction?api-version=2021-06-01", - "Content": "{\n \"properties\": {\n \"collectionIds\": [ \"a260d38c-96cf-492d-a340-404d0c4b3ad6\", \"8c7a91db-cd41-43b6-af47-2e869654126d\" ],\n \"action\": \"EnableCollections\"\n }\n}", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/bulkCollectionsAction?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"collectionIds\": [ \"a260d38c-96cf-492d-a340-404d0c4b3ad6\", \"8c7a91db-cd41-43b6-af47-2e869654126d\" ],\r\n \"action\": \"EnableCollections\"\r\n }\r\n}", "isContentBase64": false, "Headers": { }, "ContentHeaders": { "Content-Type": [ "application/json" ], - "Content-Length": [ "164" ] + "Content-Length": [ "169" ] } }, "Response": { @@ -17,27 +17,30 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1190" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=92773f2c1c67026ec4d9126bfcf778845d6357a27b8781ad374bcfa850a3111a;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=92773f2c1c67026ec4d9126bfcf778845d6357a27b8781ad374bcfa850a3111a;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-writes": [ "1195" ], - "x-ms-request-id": [ "acd4fba8-d488-4d99-b2de-bfa7e4d01d1b" ], - "x-ms-correlation-request-id": [ "acd4fba8-d488-4d99-b2de-bfa7e4d01d1b" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135910Z:acd4fba8-d488-4d99-b2de-bfa7e4d01d1b" ], + "x-azure-ref": [ "20240206T121519Z-e9fr18rg4936d7qwr39u9d2ats00000002x0000000007t6t" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "3fca786f-ff88-4507-bfe5-63760f0688a3" ], + "x-ms-correlation-request-id": [ "3fca786f-ff88-4507-bfe5-63760f0688a3" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121520Z:3fca786f-ff88-4507-bfe5-63760f0688a3" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:59:09 GMT" ] + "X-MSEdge-Ref": [ "Ref A: 91FCEAA741594FF98579AB2770FFDB02 Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:19Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:19 GMT" ] }, "ContentHeaders": { - "Content-Length": [ "201" ], + "Content-Length": [ "208" ], "Content-Type": [ "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "Content": "{\"succeeded\":[{\"collectionName\":\"DefaultCollection\",\"collectionId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\"},{\"collectionName\":\"test1\",\"collectionId\":\"8c7a91db-cd41-43b6-af47-2e869654126d\"}],\"failed\":[]}", + "Content": "{\"succeeded\":[{\"collectionName\":\"DefaultCollection\",\"collectionId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\"},{\"collectionName\":\"CopyPWRTest1\",\"collectionId\":\"8c7a91db-cd41-43b6-af47-2e869654126d\"}],\"failed\":[]}", "isContentBase64": false } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplaceBulkPrivateStoreCollectionAction.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplaceBulkPrivateStoreCollectionAction.Tests.ps1 index f637fbc627c9..c96e6c407e0c 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplaceBulkPrivateStoreCollectionAction.Tests.ps1 +++ b/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplaceBulkPrivateStoreCollectionAction.Tests.ps1 @@ -16,8 +16,8 @@ if(($null -eq $TestName) -or ($TestName -contains 'Set-AzMarketplaceBulkPrivateS Describe 'Set-AzMarketplaceBulkPrivateStoreCollectionAction' { It 'BulkExpanded' { - $res = Set-AzMarketplaceBulkPrivateStoreCollectionAction -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -Payload @{Action = "EnableCollections"; CollectionId = "a260d38c-96cf-492d-a340-404d0c4b3ad6", "8c7a91db-cd41-43b6-af47-2e869654126d" } - $res.Succeeded.Count | Should -Be 2 + $res = Set-AzMarketplaceBulkPrivateStoreCollectionAction -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -Payload @{Action = "EnableCollections"; CollectionId = "a260d38c-96cf-492d-a340-404d0c4b3ad6", "8c7a91db-cd41-43b6-af47-2e869654126d" } + $res.Succeeded.Count | Should -Be 2 } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStore.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStore.Recording.json index 44f6dda058a5..d1da14b6b595 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStore.Recording.json +++ b/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStore.Recording.json @@ -1,17 +1,17 @@ { - "Set-AzMarketplacePrivateStore+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6?api-version=2021-06-01+1": { + "Set-AzMarketplacePrivateStore+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6?api-version=2023-01-01+1": { "Request": { "Method": "GET", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6?api-version=2023-01-01", "Content": null, "isContentBase64": false, "Headers": { - "x-ms-unique-id": [ "16" ], - "x-ms-client-request-id": [ "5d0286a7-3e8d-435e-b41d-dbcaddf79427" ], + "x-ms-unique-id": [ "31" ], + "x-ms-client-request-id": [ "3fff2958-4df6-4323-ae3d-129fb7e0d9f4" ], "CommandName": [ "Get-AzMarketplacePrivateStoreV1" ], "FullCommandName": [ "Get-AzMarketplacePrivateStoreV1_Get" ], "ParameterSetName": [ "__AllParameterSets" ], - "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], "Authorization": [ "[Filtered]" ] }, "ContentHeaders": { @@ -22,41 +22,44 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11997" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=a1932161769a8d1e756ea2a33c09d2511fa99932f8d921493de9f93092d8c165;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=a1932161769a8d1e756ea2a33c09d2511fa99932f8d921493de9f93092d8c165;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-reads": [ "11995" ], - "x-ms-request-id": [ "60b18096-09d1-41ea-9fd9-b68f9c1bb81b" ], - "x-ms-correlation-request-id": [ "60b18096-09d1-41ea-9fd9-b68f9c1bb81b" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135915Z:60b18096-09d1-41ea-9fd9-b68f9c1bb81b" ], + "x-azure-ref": [ "20240206T121520Z-gwknnxeka10xrfzb2a991aarkg0000000as000000000aqh1" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "53d6f38d-5fc7-4a3f-bba9-58285c8301a8" ], + "x-ms-correlation-request-id": [ "53d6f38d-5fc7-4a3f-bba9-58285c8301a8" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121520Z:53d6f38d-5fc7-4a3f-bba9-58285c8301a8" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:59:15 GMT" ] + "X-MSEdge-Ref": [ "Ref A: 6EAEFA80747A4DE68C6F415196989933 Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:20Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:19 GMT" ] }, "ContentHeaders": { - "Content-Length": [ "1072" ], + "Content-Length": [ "1342" ], "Content-Type": [ "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":null,\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-01-24T13:59:10.6296811Z\"},\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"name\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"type\":\"Microsoft.Marketplace/privateStores\",\"properties\":{\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"availability\":\"enabled\",\"eTag\":\"\\\"1e006ab7-0000-0100-0000-61eeb0ae0000\\\"\",\"privateStoreName\":\"Azure\",\"tenantId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"isGov\":false,\"collectionIds\":[\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"8c7a91db-cd41-43b6-af47-2e869654126d\",\"fdb889a1-cf3e-49f0-95b8-2bb012fa01f1\"],\"branding\":{\"newExperience\":\"True\"},\"notificationsSettings\":{\"recipients\":[{\"principalId\":\"48d6cb80-6b16-4f18-9ce3-3a7288080a5b\",\"emailAddress\":\"DemoGroup@ContosoBayArea.onmicrosoft.com\",\"displayName\":\"Demo Group\"},{\"principalId\":\"aa209d7c-8b53-412f-b960-9f64a0f47718\",\"emailAddress\":\"\",\"displayName\":\"TestGroup\"}],\"sendToAllMarketplaceAdmins\":false}}}", + "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":null,\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-02-06T12:15:19.9276695Z\"},\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"name\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"type\":\"Microsoft.Marketplace/privateStores\",\"properties\":{\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"availability\":\"enabled\",\"eTag\":\"\\\"f3038157-0000-0100-0000-65c222d70000\\\"\",\"privateStoreName\":\"Azure\",\"tenantId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"isGov\":false,\"collectionIds\":[\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"d1bb102f-620f-460e-ba55-fdc3856c8fdd\",\"0740a3e6-d5b5-4e22-99be-26887e484fa1\",\"de165278-2dda-40aa-9ce4-15bf37311f49\",\"b411c744-55fd-43b4-b269-faf05d4edae2\",\"dbf8cede-24ff-42c0-b443-3f73df6996f7\",\"cf87e6eb-4ed1-44e5-b250-9eb5593b4c0e\",\"21ea54a6-df79-4dcb-babf-7860b8a82a9c\",\"ac13d584-7c4b-40a6-9d95-7dcf4b79db80\",\"73551ecc-d860-407f-9efa-049bab0468f5\",\"22dc7ebe-45b7-4aa6-8c96-a30091344cad\",\"5b98b8be-7b7f-46fe-8e97-a15ea77dda14\",\"65159e59-86c8-4442-b768-2595be217a0f\",\"d9b76d86-a3e7-4e9b-befb-3fe5a8d070a6\",\"0a4d89f3-8348-4961-9bec-a02780ab8144\",\"fdb889a1-cf3e-49f0-95b8-2bb012fa01f1\",\"fdb889a1-cf3e-49f0-95b8-2bb012fa0188\",\"8c7a91db-cd41-43b6-af47-2e869654126d\"],\"branding\":{\"newExperience\":\"True\"}}}", "isContentBase64": false } }, - "Set-AzMarketplacePrivateStore+[NoContext]+UpdateExpanded+$PUT+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6?api-version=2021-06-01+2": { + "Set-AzMarketplacePrivateStore+[NoContext]+UpdateExpanded+$PUT+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6?api-version=2023-01-01+2": { "Request": { "Method": "PUT", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6?api-version=2021-06-01", - "Content": "{\n \"properties\": {\n \"availability\": \"enabled\",\n \"eTag\": \"\\\"1e006ab7-0000-0100-0000-61eeb0ae0000\\\"\"\n }\n}", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"availability\": \"enabled\",\r\n \"eTag\": \"\\\"f3038157-0000-0100-0000-65c222d70000\\\"\"\r\n }\r\n}", "isContentBase64": false, "Headers": { }, "ContentHeaders": { "Content-Type": [ "application/json" ], - "Content-Length": [ "111" ] + "Content-Length": [ "116" ] } }, "Response": { @@ -64,27 +67,80 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1197" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=6c5458dd548284d7396cd2cba264e633b6118968d745d1e82e3c3f7fc14794d7;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=6c5458dd548284d7396cd2cba264e633b6118968d745d1e82e3c3f7fc14794d7;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-writes": [ "1195" ], - "x-ms-request-id": [ "965d98b4-e61b-4d15-9400-60781729c9a7" ], - "x-ms-correlation-request-id": [ "965d98b4-e61b-4d15-9400-60781729c9a7" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135916Z:965d98b4-e61b-4d15-9400-60781729c9a7" ], + "x-azure-ref": [ "20240206T121520Z-e9fr18rg4936d7qwr39u9d2ats000000030g000000007k5u" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "b5385742-ecc0-4324-be9f-41f5b6f5cee6" ], + "x-ms-correlation-request-id": [ "b5385742-ecc0-4324-be9f-41f5b6f5cee6" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121521Z:b5385742-ecc0-4324-be9f-41f5b6f5cee6" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:59:16 GMT" ] + "X-MSEdge-Ref": [ "Ref A: 83661893D4614F96BCFE0A7FD239BC53 Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:20Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:20 GMT" ] }, "ContentHeaders": { - "Content-Length": [ "757" ], + "Content-Length": [ "1342" ], "Content-Type": [ "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":null,\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-01-24T13:59:16.5690315Z\"},\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"name\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"type\":\"Microsoft.Marketplace/privateStores\",\"properties\":{\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"availability\":\"enabled\",\"eTag\":\"\\\"1e00e4b7-0000-0100-0000-61eeb0b40000\\\"\",\"privateStoreName\":\"Azure\",\"tenantId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"isGov\":false,\"collectionIds\":[\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"8c7a91db-cd41-43b6-af47-2e869654126d\",\"fdb889a1-cf3e-49f0-95b8-2bb012fa01f1\"],\"branding\":{\"newExperience\":\"True\"}}}", + "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":null,\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-02-06T12:15:21.2381732Z\"},\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"name\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"type\":\"Microsoft.Marketplace/privateStores\",\"properties\":{\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"availability\":\"enabled\",\"eTag\":\"\\\"f303ab57-0000-0100-0000-65c222d90000\\\"\",\"privateStoreName\":\"Azure\",\"tenantId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"isGov\":false,\"collectionIds\":[\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"d1bb102f-620f-460e-ba55-fdc3856c8fdd\",\"0740a3e6-d5b5-4e22-99be-26887e484fa1\",\"de165278-2dda-40aa-9ce4-15bf37311f49\",\"b411c744-55fd-43b4-b269-faf05d4edae2\",\"dbf8cede-24ff-42c0-b443-3f73df6996f7\",\"cf87e6eb-4ed1-44e5-b250-9eb5593b4c0e\",\"21ea54a6-df79-4dcb-babf-7860b8a82a9c\",\"ac13d584-7c4b-40a6-9d95-7dcf4b79db80\",\"73551ecc-d860-407f-9efa-049bab0468f5\",\"22dc7ebe-45b7-4aa6-8c96-a30091344cad\",\"5b98b8be-7b7f-46fe-8e97-a15ea77dda14\",\"65159e59-86c8-4442-b768-2595be217a0f\",\"d9b76d86-a3e7-4e9b-befb-3fe5a8d070a6\",\"0a4d89f3-8348-4961-9bec-a02780ab8144\",\"fdb889a1-cf3e-49f0-95b8-2bb012fa01f1\",\"fdb889a1-cf3e-49f0-95b8-2bb012fa0188\",\"8c7a91db-cd41-43b6-af47-2e869654126d\"],\"branding\":{\"newExperience\":\"True\"}}}", + "isContentBase64": false + } + }, + "Set-AzMarketplacePrivateStore+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6?api-version=2023-01-01+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6?api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "33" ], + "x-ms-client-request-id": [ "dc763bad-0d3d-41fc-afc4-a879285522bb" ], + "CommandName": [ "Get-AzMarketplacePrivateStoreV1" ], + "FullCommandName": [ "Get-AzMarketplacePrivateStoreV1_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11996" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121521Z-8f6r3xskwh4btc8yq2qh5g5fz40000000950000000007b2m" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "58019428-da54-45eb-8695-6ddab76c40e8" ], + "x-ms-correlation-request-id": [ "58019428-da54-45eb-8695-6ddab76c40e8" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121521Z:58019428-da54-45eb-8695-6ddab76c40e8" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: 76CFA44D69B84DB7BDE85EF492159B29 Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:21Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:20 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1342" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":null,\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-02-06T12:15:21.2381732Z\"},\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"name\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"type\":\"Microsoft.Marketplace/privateStores\",\"properties\":{\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"availability\":\"enabled\",\"eTag\":\"\\\"f303ab57-0000-0100-0000-65c222d90000\\\"\",\"privateStoreName\":\"Azure\",\"tenantId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"isGov\":false,\"collectionIds\":[\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"d1bb102f-620f-460e-ba55-fdc3856c8fdd\",\"0740a3e6-d5b5-4e22-99be-26887e484fa1\",\"de165278-2dda-40aa-9ce4-15bf37311f49\",\"b411c744-55fd-43b4-b269-faf05d4edae2\",\"dbf8cede-24ff-42c0-b443-3f73df6996f7\",\"cf87e6eb-4ed1-44e5-b250-9eb5593b4c0e\",\"21ea54a6-df79-4dcb-babf-7860b8a82a9c\",\"ac13d584-7c4b-40a6-9d95-7dcf4b79db80\",\"73551ecc-d860-407f-9efa-049bab0468f5\",\"22dc7ebe-45b7-4aa6-8c96-a30091344cad\",\"5b98b8be-7b7f-46fe-8e97-a15ea77dda14\",\"65159e59-86c8-4442-b768-2595be217a0f\",\"d9b76d86-a3e7-4e9b-befb-3fe5a8d070a6\",\"0a4d89f3-8348-4961-9bec-a02780ab8144\",\"fdb889a1-cf3e-49f0-95b8-2bb012fa01f1\",\"fdb889a1-cf3e-49f0-95b8-2bb012fa0188\",\"8c7a91db-cd41-43b6-af47-2e869654126d\"],\"branding\":{\"newExperience\":\"True\"}}}", "isContentBase64": false } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStore.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStore.Tests.ps1 index 710a0007d434..110e6e93c235 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStore.Tests.ps1 +++ b/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStore.Tests.ps1 @@ -17,7 +17,8 @@ if(($null -eq $TestName) -or ($TestName -contains 'Set-AzMarketplacePrivateStore Describe 'Set-AzMarketplacePrivateStore' { It 'UpdateExpanded' { $res = Get-AzMarketplacePrivateStoreV1 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 - Set-AzMarketplacePrivateStore -Id a260d38c-96cf-492d-a340-404d0c4b3ad6 -Availability 'enabled' -ETag $res.ETag - $res.Availability | Should -Be "enabled" + Set-AzMarketplacePrivateStore -Id a260d38c-96cf-492d-a340-404d0c4b3ad6 -Availability 'enabled' -ETag $res.ETag + $res = Get-AzMarketplacePrivateStoreV1 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 + $res.Availability | Should -Be "enabled" } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStoreCollection.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStoreCollection.Recording.json index 0a2e39b45086..428b1a036930 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStoreCollection.Recording.json +++ b/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStoreCollection.Recording.json @@ -1,15 +1,15 @@ { - "Set-AzMarketplacePrivateStoreCollection+[NoContext]+UpdateExpanded+$PUT+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/7f5402e4-e8f4-46bd-9bd1-8d27866a6065?api-version=2021-06-01+1": { + "Set-AzMarketplacePrivateStoreCollection+[NoContext]+UpdateExpanded+$PUT+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d?api-version=2023-01-01+1": { "Request": { "Method": "PUT", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/7f5402e4-e8f4-46bd-9bd1-8d27866a6065?api-version=2021-06-01", - "Content": "{\n \"properties\": {\n \"collectionName\": \"setColltest\",\n \"subscriptionsList\": [ \"1052ff5a-aa43-4ca1-bd18-010399494ce5\" ]\n }\n}", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"collectionName\": \"PWSH_Test1\",\r\n \"enabled\": true\r\n }\r\n}", "isContentBase64": false, "Headers": { }, "ContentHeaders": { "Content-Type": [ "application/json" ], - "Content-Length": [ "130" ] + "Content-Length": [ "86" ] } }, "Response": { @@ -17,85 +17,46 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1198" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=d3888da00a6c22fd6922d241b1e1f8b74760295bc9888c172907d962f5a68055;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=d3888da00a6c22fd6922d241b1e1f8b74760295bc9888c172907d962f5a68055;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-writes": [ "1194" ], - "x-ms-request-id": [ "c712e75d-596e-4684-a2bc-2ed2ec011ef7" ], - "x-ms-correlation-request-id": [ "c712e75d-596e-4684-a2bc-2ed2ec011ef7" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135920Z:c712e75d-596e-4684-a2bc-2ed2ec011ef7" ], + "x-azure-ref": [ "20240206T121522Z-un93fkbvw50w5bbm67x1677wk800000009c0000000008mtk" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "71a52e70-c651-44f1-a3d2-bd7260c74874" ], + "x-ms-correlation-request-id": [ "71a52e70-c651-44f1-a3d2-bd7260c74874" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121522Z:71a52e70-c651-44f1-a3d2-bd7260c74874" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:59:20 GMT" ] + "X-MSEdge-Ref": [ "Ref A: D14686990ED2419EAA4CAC1C267B8FC2 Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:22Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:21 GMT" ] }, "ContentHeaders": { - "Content-Length": [ "669" ], + "Content-Length": [ "667" ], "Content-Type": [ "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2022-01-24T13:59:20.1132632Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-01-24T13:59:20.1333443Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/7f5402e4-e8f4-46bd-9bd1-8d27866a6065\",\"name\":\"7f5402e4-e8f4-46bd-9bd1-8d27866a6065\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"collectionId\":\"7f5402e4-e8f4-46bd-9bd1-8d27866a6065\",\"collectionName\":\"setColltest\",\"claim\":null,\"allSubscriptions\":false,\"subscriptionsList\":[\"1052ff5a-aa43-4ca1-bd18-010399494ce5\"],\"enabled\":false,\"numberOfOffers\":0}}", + "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2024-02-06T12:14:35.3055425Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-02-06T12:15:22.2653871Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d\",\"name\":\"8c7a91db-cd41-43b6-af47-2e869654126d\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"collectionId\":\"8c7a91db-cd41-43b6-af47-2e869654126d\",\"collectionName\":\"PWSH_Test1\",\"claim\":null,\"allSubscriptions\":false,\"subscriptionsList\":[\"1052ff5a-aa43-4ca1-bd18-010399494ce5\"],\"enabled\":true,\"numberOfOffers\":0}}", "isContentBase64": false } }, - "Set-AzMarketplacePrivateStoreCollection+[NoContext]+UpdateExpanded+$PUT+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/7f5402e4-e8f4-46bd-9bd1-8d27866a6065?api-version=2021-06-01+2": { - "Request": { - "Method": "PUT", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/7f5402e4-e8f4-46bd-9bd1-8d27866a6065?api-version=2021-06-01", - "Content": "{\n \"properties\": {\n \"collectionName\": \"setColltest1\",\n \"enabled\": true\n }\n}", - "isContentBase64": false, - "Headers": { - }, - "ContentHeaders": { - "Content-Type": [ "application/json" ], - "Content-Length": [ "83" ] - } - }, - "Response": { - "StatusCode": 200, - "Headers": { - "Cache-Control": [ "no-cache" ], - "Pragma": [ "no-cache" ], - "Vary": [ "Accept-Encoding" ], - "X-Content-Type-Options": [ "nosniff" ], - "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=ac34b1a047b7a77113a516ef142ac6ff661eaaf7884099e34431a940426d41cc;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=ac34b1a047b7a77113a516ef142ac6ff661eaaf7884099e34431a940426d41cc;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], - "X-AspNet-Version": [ "4.0.30319" ], - "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-writes": [ "1193" ], - "x-ms-request-id": [ "95628ca8-42b1-4c6e-869e-2ffb244f0d59" ], - "x-ms-correlation-request-id": [ "95628ca8-42b1-4c6e-869e-2ffb244f0d59" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135921Z:95628ca8-42b1-4c6e-869e-2ffb244f0d59" ], - "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:59:20 GMT" ] - }, - "ContentHeaders": { - "Content-Length": [ "669" ], - "Content-Type": [ "application/json; charset=utf-8" ], - "Expires": [ "-1" ] - }, - "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2022-01-24T13:59:20.1132632Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-01-24T13:59:20.8991248Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/7f5402e4-e8f4-46bd-9bd1-8d27866a6065\",\"name\":\"7f5402e4-e8f4-46bd-9bd1-8d27866a6065\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"collectionId\":\"7f5402e4-e8f4-46bd-9bd1-8d27866a6065\",\"collectionName\":\"setColltest1\",\"claim\":null,\"allSubscriptions\":false,\"subscriptionsList\":[\"1052ff5a-aa43-4ca1-bd18-010399494ce5\"],\"enabled\":true,\"numberOfOffers\":0}}", - "isContentBase64": false - } - }, - "Set-AzMarketplacePrivateStoreCollection+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/7f5402e4-e8f4-46bd-9bd1-8d27866a6065?api-version=2021-06-01+3": { + "Set-AzMarketplacePrivateStoreCollection+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d?api-version=2023-01-01+2": { "Request": { "Method": "GET", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/7f5402e4-e8f4-46bd-9bd1-8d27866a6065?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d?api-version=2023-01-01", "Content": null, "isContentBase64": false, "Headers": { - "x-ms-unique-id": [ "20" ], - "x-ms-client-request-id": [ "ae62d85d-996c-4b5a-bc50-5e9adb0d5aaf" ], + "x-ms-unique-id": [ "35" ], + "x-ms-client-request-id": [ "d894d35b-902b-4218-829d-cb4368f5ff22" ], "CommandName": [ "Get-AzMarketplacePrivateStoreCollection" ], "FullCommandName": [ "Get-AzMarketplacePrivateStoreCollection_Get" ], "ParameterSetName": [ "__AllParameterSets" ], - "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], "Authorization": [ "[Filtered]" ] }, "ContentHeaders": { @@ -106,27 +67,30 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11996" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=b04ffa86539d7689519d8eb5d5e7423177e93a8afca318b1f76e4c8444a7d2a2;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=b04ffa86539d7689519d8eb5d5e7423177e93a8afca318b1f76e4c8444a7d2a2;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-reads": [ "11994" ], - "x-ms-request-id": [ "b24867a0-1331-46bb-a1de-eecadb502c77" ], - "x-ms-correlation-request-id": [ "b24867a0-1331-46bb-a1de-eecadb502c77" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135921Z:b24867a0-1331-46bb-a1de-eecadb502c77" ], + "x-azure-ref": [ "20240206T121522Z-puek9bzdet0fz0hz46rmzq0b5c0000000bhg000000002ecu" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "ed935d91-bd3c-4532-8d13-a66a8ee3999d" ], + "x-ms-correlation-request-id": [ "ed935d91-bd3c-4532-8d13-a66a8ee3999d" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121522Z:ed935d91-bd3c-4532-8d13-a66a8ee3999d" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:59:21 GMT" ] + "X-MSEdge-Ref": [ "Ref A: D1593CAC96204BC39652D75102453838 Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:22Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:21 GMT" ] }, "ContentHeaders": { - "Content-Length": [ "631" ], + "Content-Length": [ "731" ], "Content-Type": [ "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2022-01-24T13:59:20.1132632Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-01-24T13:59:20.8991248Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/7f5402e4-e8f4-46bd-9bd1-8d27866a6065\",\"name\":\"7f5402e4-e8f4-46bd-9bd1-8d27866a6065\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"collectionId\":\"7f5402e4-e8f4-46bd-9bd1-8d27866a6065\",\"collectionName\":\"setColltest1\",\"claim\":null,\"allSubscriptions\":false,\"subscriptionsList\":[],\"enabled\":true,\"numberOfOffers\":0}}", + "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2024-02-06T12:14:35.3055425Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-02-06T12:15:22.2653871Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d\",\"name\":\"8c7a91db-cd41-43b6-af47-2e869654126d\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":null,\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"0001-01-01T00:00:00.0000000\",\"collectionId\":\"8c7a91db-cd41-43b6-af47-2e869654126d\",\"collectionName\":\"PWSH_Test1\",\"claim\":null,\"allSubscriptions\":false,\"subscriptionsList\":[],\"enabled\":true,\"numberOfOffers\":1}}", "isContentBase64": false } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStoreCollection.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStoreCollection.Tests.ps1 index aa5be02d939e..9175732b2811 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStoreCollection.Tests.ps1 +++ b/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStoreCollection.Tests.ps1 @@ -16,12 +16,10 @@ if(($null -eq $TestName) -or ($TestName -contains 'Set-AzMarketplacePrivateStore Describe 'Set-AzMarketplacePrivateStoreCollection' { It 'UpdateExpanded' { - New-AzMarketplacePrivateStoreCollection -CollectionName setColltest -CollectionId 7f5402e4-e8f4-46bd-9bd1-8d27866a6065 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionsList 1052ff5a-aa43-4ca1-bd18-010399494ce5 - - Set-AzMarketplacePrivateStoreCollection -CollectionId 7f5402e4-e8f4-46bd-9bd1-8d27866a6065 -CollectionName setColltest1 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -Enabled - - $res = Get-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId 7f5402e4-e8f4-46bd-9bd1-8d27866a6065 - $res.Enabled | Should -be $true + Set-AzMarketplacePrivateStoreCollection -CollectionId 8c7a91db-cd41-43b6-af47-2e869654126d -CollectionName PWSH_Test1 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -Enabled + $res = Get-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId 8c7a91db-cd41-43b6-af47-2e869654126d + $res.Enabled | Should -Be $true + $res.collectionName | Should -be PWSH_Test1 } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStoreCollectionOffer.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStoreCollectionOffer.Recording.json index 6c4ce0edc81f..31d735ff04b1 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStoreCollectionOffer.Recording.json +++ b/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStoreCollectionOffer.Recording.json @@ -1,15 +1,15 @@ { - "Set-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+UpdateExpanded+$PUT+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188?api-version=2021-06-01+1": { + "Set-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+UpdateExpanded+$PUT+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188?api-version=2023-01-01+1": { "Request": { "Method": "PUT", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188?api-version=2021-06-01", - "Content": "{\n \"properties\": {\n \"collectionName\": \"test134\",\n \"subscriptionsList\": [ \"1052ff5a-aa43-4ca1-bd18-010399494ce5\" ]\n }\n}", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"collectionName\": \"test134\",\r\n \"subscriptionsList\": [ \"1052ff5a-aa43-4ca1-bd18-010399494ce5\" ]\r\n }\r\n}", "isContentBase64": false, "Headers": { }, "ContentHeaders": { "Content-Type": [ "application/json" ], - "Content-Length": [ "126" ] + "Content-Length": [ "131" ] } }, "Response": { @@ -17,41 +17,44 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1194" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=a1932161769a8d1e756ea2a33c09d2511fa99932f8d921493de9f93092d8c165;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=a1932161769a8d1e756ea2a33c09d2511fa99932f8d921493de9f93092d8c165;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-writes": [ "1192" ], - "x-ms-request-id": [ "525d0938-b3c6-4fd6-9583-586fbafcd1ad" ], - "x-ms-correlation-request-id": [ "525d0938-b3c6-4fd6-9583-586fbafcd1ad" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135925Z:525d0938-b3c6-4fd6-9583-586fbafcd1ad" ], + "x-azure-ref": [ "20240206T122226Z-8f6r3xskwh4btc8yq2qh5g5fz40000000950000000007p7s" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "9ebc9672-aa39-4dce-85eb-0b3cd8235cb0" ], + "x-ms-correlation-request-id": [ "9ebc9672-aa39-4dce-85eb-0b3cd8235cb0" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T122227Z:9ebc9672-aa39-4dce-85eb-0b3cd8235cb0" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:59:24 GMT" ] + "X-MSEdge-Ref": [ "Ref A: 3FB5D02111EC457FAECF78F9EE1D8C29 Ref B: MRS211050619051 Ref C: 2024-02-06T12:22:26Z" ], + "Date": [ "Tue, 06 Feb 2024 12:22:26 GMT" ] }, "ContentHeaders": { "Content-Length": [ "665" ], "Content-Type": [ "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2022-01-24T13:59:24.9775806Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-01-24T13:59:24.9976181Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188\",\"name\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa0188\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"collectionId\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa0188\",\"collectionName\":\"test134\",\"claim\":null,\"allSubscriptions\":false,\"subscriptionsList\":[\"1052ff5a-aa43-4ca1-bd18-010399494ce5\"],\"enabled\":false,\"numberOfOffers\":0}}", + "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2024-02-06T12:22:24.5682275Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-02-06T12:22:27.0109473Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188\",\"name\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa0188\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"collectionId\":\"fdb889a1-cf3e-49f0-95b8-2bb012fa0188\",\"collectionName\":\"test134\",\"claim\":null,\"allSubscriptions\":false,\"subscriptionsList\":[\"1052ff5a-aa43-4ca1-bd18-010399494ce5\"],\"enabled\":false,\"numberOfOffers\":0}}", "isContentBase64": false } }, - "Set-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+UpdateExpanded+$PUT+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188/offers/aumatics.azure_managedservices?api-version=2021-06-01+2": { + "Set-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+UpdateExpanded+$PUT+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188/offers/aumatics.azure_managedservices?api-version=2023-01-01+2": { "Request": { "Method": "PUT", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188/offers/aumatics.azure_managedservices?api-version=2021-06-01", - "Content": "{\n \"properties\": {\n \"plans\": [\n {\n \"accessibility\": \"azure_managedservices_professional\"\n }\n ]\n }\n}", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188/offers/aumatics.azure_managedservices?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"plans\": [\r\n {\r\n \"accessibility\": \"azure_managedservices_professional\"\r\n }\r\n ]\r\n }\r\n}", "isContentBase64": false, "Headers": { }, "ContentHeaders": { "Content-Type": [ "application/json" ], - "Content-Length": [ "124" ] + "Content-Length": [ "132" ] } }, "Response": { @@ -59,43 +62,46 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=bfe2117850ddf2eb1a1bdbff379f22be7abd277495b3d0ff28b1c1254c65d847;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1194" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=96b32ba767f19bc2be802a1a84fdc00853c28f5d538f067794a88bb9cdc29727;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=96b32ba767f19bc2be802a1a84fdc00853c28f5d538f067794a88bb9cdc29727;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-writes": [ "1191" ], - "x-ms-request-id": [ "247b028f-13c3-4e80-aa2a-b04fd530b8e4" ], - "x-ms-correlation-request-id": [ "247b028f-13c3-4e80-aa2a-b04fd530b8e4" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135925Z:247b028f-13c3-4e80-aa2a-b04fd530b8e4" ], + "x-azure-ref": [ "20240206T122227Z-t7c72rkz312716843t9pzrc2tg0000000aug00000000077s" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "d745028d-1b61-43a2-8729-d20a2e0713c8" ], + "x-ms-correlation-request-id": [ "d745028d-1b61-43a2-8729-d20a2e0713c8" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T122228Z:d745028d-1b61-43a2-8729-d20a2e0713c8" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:59:25 GMT" ] + "X-MSEdge-Ref": [ "Ref A: D3ABD943B648437E9C0F51484F22DC3B Ref B: MRS211050619051 Ref C: 2024-02-06T12:22:27Z" ], + "Date": [ "Tue, 06 Feb 2024 12:22:27 GMT" ] }, "ContentHeaders": { "Content-Length": [ "524" ], "Content-Type": [ "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "Content": "{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188/offers/aumatics.azure_managedservices\",\"name\":\"aumatics.azure_managedservices\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"aumatics.azure_managedservices\",\"specificPlanIdsLimitation\":null,\"eTag\":\"\\\"1e00d2b8-0000-0100-0000-61eeb0bd0000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}}", + "Content": "{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188/offers/aumatics.azure_managedservices\",\"name\":\"aumatics.azure_managedservices\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"aumatics.azure_managedservices\",\"specificPlanIdsLimitation\":null,\"eTag\":\"\\\"f3037f86-0000-0100-0000-65c224840000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}}", "isContentBase64": false } }, - "Set-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188/offers/aumatics.azure_managedservices?api-version=2021-06-01+3": { + "Set-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188/offers/aumatics.azure_managedservices?api-version=2023-01-01+3": { "Request": { "Method": "GET", - "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188/offers/aumatics.azure_managedservices?api-version=2021-06-01", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188/offers/aumatics.azure_managedservices?api-version=2023-01-01", "Content": null, "isContentBase64": false, "Headers": { - "x-ms-unique-id": [ "23" ], - "x-ms-client-request-id": [ "d146b7c6-f2f3-45f5-8742-dac5fe3032c6" ], + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "e8315f31-5d95-4950-b659-811c5275b084" ], "CommandName": [ "Get-AzMarketplacePrivateStoreCollectionOffer" ], "FullCommandName": [ "Get-AzMarketplacePrivateStoreCollectionOffer_Get" ], "ParameterSetName": [ "__AllParameterSets" ], - "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], "Authorization": [ "[Filtered]" ] }, "ContentHeaders": { @@ -106,27 +112,30 @@ "Headers": { "Cache-Control": [ "no-cache" ], "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11989" ], "X-Content-Type-Options": [ "nosniff" ], "X-XSS-Protection": [ "1; mode=block" ], - "x-ms-version": [ "6.0.01832.0004-467b09b3" ], - "Set-Cookie": [ "ARRAffinity=b115d2f875c66b84b700975954f361f48f95995b3649b85a0990b9141d8b2e7d;Path=/;HttpOnly;Secure;Domain=marketplacerp.azure.com", "ARRAffinitySameSite=b115d2f875c66b84b700975954f361f48f95995b3649b85a0990b9141d8b2e7d;Path=/;HttpOnly;SameSite=None;Secure;Domain=marketplacerp.azure.com" ], - "Server": [ "Microsoft-IIS/10.0" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], "X-AspNet-Version": [ "4.0.30319" ], "X-Powered-By": [ "ASP.NET" ], - "x-ms-ratelimit-remaining-tenant-reads": [ "11993" ], - "x-ms-request-id": [ "4d483bb2-c98a-4f92-8f7f-1de8384197c5" ], - "x-ms-correlation-request-id": [ "4d483bb2-c98a-4f92-8f7f-1de8384197c5" ], - "x-ms-routing-request-id": [ "UAECENTRAL:20220124T135926Z:4d483bb2-c98a-4f92-8f7f-1de8384197c5" ], + "x-azure-ref": [ "20240206T122228Z-p4qrcvy1bt1fzaf9y6gvrq4w4g0000000beg000000001up8" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "33e2b093-e923-4731-af5f-7eee04d059c4" ], + "x-ms-correlation-request-id": [ "33e2b093-e923-4731-af5f-7eee04d059c4" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T122228Z:33e2b093-e923-4731-af5f-7eee04d059c4" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], - "Date": [ "Mon, 24 Jan 2022 13:59:26 GMT" ] + "X-MSEdge-Ref": [ "Ref A: 94B49F96F82145069A3DE1FEC5CEE948 Ref B: MRS211050619051 Ref C: 2024-02-06T12:22:28Z" ], + "Date": [ "Tue, 06 Feb 2024 12:22:28 GMT" ] }, "ContentHeaders": { "Content-Length": [ "524" ], "Content-Type": [ "application/json; charset=utf-8" ], "Expires": [ "-1" ] }, - "Content": "{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188/offers/aumatics.azure_managedservices\",\"name\":\"aumatics.azure_managedservices\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"aumatics.azure_managedservices\",\"specificPlanIdsLimitation\":null,\"eTag\":\"\\\"1e00d2b8-0000-0100-0000-61eeb0bd0000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}}", + "Content": "{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/fdb889a1-cf3e-49f0-95b8-2bb012fa0188/offers/aumatics.azure_managedservices\",\"name\":\"aumatics.azure_managedservices\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"aumatics.azure_managedservices\",\"specificPlanIdsLimitation\":null,\"eTag\":\"\\\"f3037f86-0000-0100-0000-65c224840000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}}", "isContentBase64": false } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 index 2d9b1ba8a2c2..ad4c5ebbd3ba 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 +++ b/src/Marketplace/Marketplace.Autorest/test/Set-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 @@ -15,13 +15,13 @@ if(($null -eq $TestName) -or ($TestName -contains 'Set-AzMarketplacePrivateStore } Describe 'Set-AzMarketplacePrivateStoreCollectionOffer' { - It 'UpdateExpanded' { - New-AzMarketplacePrivateStoreCollection -CollectionName test134 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionsList 1052ff5a-aa43-4ca1-bd18-010399494ce5 - $acc = @{Accessibility = "azure_managedservices_professional"} - New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -OfferId aumatics.azure_managedservices -Plan $acc + It 'UpdateExpanded' { + New-AzMarketplacePrivateStoreCollection -CollectionName test134 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionsList 1052ff5a-aa43-4ca1-bd18-010399494ce5 + $acc = @{Accessibility = "azure_managedservices_professional"} + New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -OfferId aumatics.azure_managedservices -Plan $acc - - $res = Get-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 -OfferId aumatics.azure_managedservices - $res.UniqueOfferId | Should -Be "aumatics.azure_managedservices" + + $res = Get-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 -OfferId aumatics.azure_managedservices + $res.UniqueOfferId | Should -Be "aumatics.azure_managedservices" } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Test-AzMarketplacePrivateStoreAnyExistingOffer.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Test-AzMarketplacePrivateStoreAnyExistingOffer.Recording.json new file mode 100644 index 000000000000..0c3e30ee5efc --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Test-AzMarketplacePrivateStoreAnyExistingOffer.Recording.json @@ -0,0 +1,52 @@ +{ + "Test-AzMarketplacePrivateStoreAnyExistingOffer+[NoContext]+Any+$POST+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/anyExistingOffersInTheCollections?api-version=2023-01-01+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/anyExistingOffersInTheCollections?api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "38" ], + "x-ms-client-request-id": [ "d1d22991-838d-4152-a7ce-b3ce929e546c" ], + "CommandName": [ "Test-AzMarketplacePrivateStoreAnyExistingOffer" ], + "FullCommandName": [ "Test-AzMarketplacePrivateStoreAnyExistingOffer_Any" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1195" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121524Z-e9fr18rg4936d7qwr39u9d2ats000000030g000000007k7v" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "e0705120-f296-449d-8f22-8acf7b354711" ], + "x-ms-correlation-request-id": [ "e0705120-f296-449d-8f22-8acf7b354711" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121524Z:e0705120-f296-449d-8f22-8acf7b354711" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: F53A8437DEDF44FCA936F53D96422C46 Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:24Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:23 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "14" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":true}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/test/Remove-AzMarketplacePrivateStore.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Test-AzMarketplacePrivateStoreAnyExistingOffer.Tests.ps1 similarity index 52% rename from src/Marketplace/Marketplace.Autorest/test/Remove-AzMarketplacePrivateStore.Tests.ps1 rename to src/Marketplace/Marketplace.Autorest/test/Test-AzMarketplacePrivateStoreAnyExistingOffer.Tests.ps1 index a3889eb75c93..0afc5fb53634 100644 --- a/src/Marketplace/Marketplace.Autorest/test/Remove-AzMarketplacePrivateStore.Tests.ps1 +++ b/src/Marketplace/Marketplace.Autorest/test/Test-AzMarketplacePrivateStoreAnyExistingOffer.Tests.ps1 @@ -1,11 +1,11 @@ -if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzMarketplacePrivateStore')) +if(($null -eq $TestName) -or ($TestName -contains 'Test-AzMarketplacePrivateStoreAnyExistingOffer')) { $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' if (-Not (Test-Path -Path $loadEnvPath)) { $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' } . ($loadEnvPath) - $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzMarketplacePrivateStore.Recording.json' + $TestRecordingFile = Join-Path $PSScriptRoot 'Test-AzMarketplacePrivateStoreAnyExistingOffer.Recording.json' $currentPath = $PSScriptRoot while(-not $mockingPath) { $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File @@ -14,12 +14,9 @@ if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzMarketplacePrivateSt . ($mockingPath | Select-Object -First 1).FullName } -Describe 'Remove-AzMarketplacePrivateStore' { - It 'Delete' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'DeleteViaIdentity' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw +Describe 'Test-AzMarketplacePrivateStoreAnyExistingOffer' { + It 'Any' { + $res = Test-AzMarketplacePrivateStoreAnyExistingOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 + $res | Should -Not -Be $null } } diff --git a/src/Marketplace/Marketplace.Autorest/test/Update-AzMarketplacePrivateStoreCollection.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Update-AzMarketplacePrivateStoreCollection.Recording.json new file mode 100644 index 000000000000..eda2d9766d6a --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Update-AzMarketplacePrivateStoreCollection.Recording.json @@ -0,0 +1,97 @@ +{ + "Update-AzMarketplacePrivateStoreCollection+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d?api-version=2023-01-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d?api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "39" ], + "x-ms-client-request-id": [ "8efb35e5-6863-4f1e-b40c-e8b08b8806e2" ], + "CommandName": [ "Update-AzMarketplacePrivateStoreCollection" ], + "FullCommandName": [ "Update-AzMarketplacePrivateStoreCollection_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11998" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121525Z-un93fkbvw50w5bbm67x1677wk800000009c0000000008mw0" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "a0645d59-f103-4bd8-b981-c3f6ffe2add0" ], + "x-ms-correlation-request-id": [ "a0645d59-f103-4bd8-b981-c3f6ffe2add0" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121525Z:a0645d59-f103-4bd8-b981-c3f6ffe2add0" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: F753F773AB8F4912B3A9D3C95BB8CE64 Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:25Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "731" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2024-02-06T12:14:35.3055425Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-02-06T12:15:22.2653871Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d\",\"name\":\"8c7a91db-cd41-43b6-af47-2e869654126d\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"appliedRules\":null,\"approveAllItems\":false,\"approveAllItemsModifiedAt\":\"0001-01-01T00:00:00.0000000\",\"collectionId\":\"8c7a91db-cd41-43b6-af47-2e869654126d\",\"collectionName\":\"PWSH_Test1\",\"claim\":null,\"allSubscriptions\":false,\"subscriptionsList\":[],\"enabled\":true,\"numberOfOffers\":1}}", + "isContentBase64": false + } + }, + "Update-AzMarketplacePrivateStoreCollection+[NoContext]+UpdateExpanded+$PUT+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d?api-version=2023-01-01+2": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"collectionName\": \"PWSH_Test1\",\r\n \"allSubscriptions\": false,\r\n \"subscriptionsList\": [ ],\r\n \"enabled\": true\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "149" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=80c7a5f90186ed67b1a22b2d6ba64306a36f909c848093374b79f8b04109a233;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1196" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121525Z-gwknnxeka10xrfzb2a991aarkg0000000as000000000aqnb" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "84e34e21-9e47-4218-a435-7a5844dc7949" ], + "x-ms-correlation-request-id": [ "84e34e21-9e47-4218-a435-7a5844dc7949" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121525Z:84e34e21-9e47-4218-a435-7a5844dc7949" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: C2B1105E51EC4D11BFCA5E530DC40EC0 Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:25Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "629" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"systemData\":{\"createdBy\":\"\",\"createdByType\":\"User\",\"createdAt\":\"2024-02-06T12:14:35.3055425Z\",\"lastModifiedBy\":\"\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2024-02-06T12:15:25.4529484Z\"},\"id\":\"providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d\",\"name\":\"8c7a91db-cd41-43b6-af47-2e869654126d\",\"type\":\"Microsoft.Marketplace/privateStores/collections\",\"properties\":{\"collectionId\":\"8c7a91db-cd41-43b6-af47-2e869654126d\",\"collectionName\":\"PWSH_Test1\",\"claim\":null,\"allSubscriptions\":false,\"subscriptionsList\":[],\"enabled\":true,\"numberOfOffers\":0}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/test/Update-AzMarketplacePrivateStoreCollection.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Update-AzMarketplacePrivateStoreCollection.Tests.ps1 new file mode 100644 index 000000000000..064018a7ca02 --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Update-AzMarketplacePrivateStoreCollection.Tests.ps1 @@ -0,0 +1,23 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzMarketplacePrivateStoreCollection')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzMarketplacePrivateStoreCollection.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzMarketplacePrivateStoreCollection' { + It 'UpdateExpanded' { + $res = Update-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId 8c7a91db-cd41-43b6-af47-2e869654126d -Enabled + $res | Should -Not -Be $null + $res.Enabled | Should -Be $true + } +} diff --git a/src/Marketplace/Marketplace.Autorest/test/Update-AzMarketplacePrivateStoreCollectionOffer.Recording.json b/src/Marketplace/Marketplace.Autorest/test/Update-AzMarketplacePrivateStoreCollectionOffer.Recording.json new file mode 100644 index 000000000000..1868670502ef --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Update-AzMarketplacePrivateStoreCollectionOffer.Recording.json @@ -0,0 +1,142 @@ +{ + "Update-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+UpdateExpanded+$PUT+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d/offers/aumatics.azure_managedservices?api-version=2023-01-01+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d/offers/aumatics.azure_managedservices?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"plans\": [\r\n {\r\n \"accessibility\": \"azure_managedservices_professional\"\r\n }\r\n ]\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "132" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1198" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121526Z-puek9bzdet0fz0hz46rmzq0b5c0000000bhg000000002ef1" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "fd070792-5507-4033-ab39-bc7dc66fe9a8" ], + "x-ms-correlation-request-id": [ "fd070792-5507-4033-ab39-bc7dc66fe9a8" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121526Z:fd070792-5507-4033-ab39-bc7dc66fe9a8" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: B1B6F3F41B0245D7A2632154EF2BBF84 Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:26Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:25 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "523" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d/offers/aumatics.azure_managedservices\",\"name\":\"aumatics.azure_managedservices\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"aumatics.azure_managedservices\",\"specificPlanIdsLimitation\":null,\"eTag\":\"\\\"f3039b52-0000-0100-0000-65c222ad0000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":true}}", + "isContentBase64": false + } + }, + "Update-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d/offers/aumatics.azure_managedservices?api-version=2023-01-01+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d/offers/aumatics.azure_managedservices?api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "42" ], + "x-ms-client-request-id": [ "fe1fa2c4-ecf8-442b-988a-d6a1c25bc026" ], + "CommandName": [ "Update-AzMarketplacePrivateStoreCollectionOffer" ], + "FullCommandName": [ "Update-AzMarketplacePrivateStoreCollectionOffer_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.11", "Az.Marketplace/1.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=71c5ecfca949e38fa6d8b6899df69a8bc1065f71ea6211c776e43d3b7b216b7d;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11996" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121526Z-e9fr18rg4936d7qwr39u9d2ats00000002x0000000007tbw" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "f9aa39ce-0d10-4ea4-a57d-6d81e9cb74a3" ], + "x-ms-correlation-request-id": [ "f9aa39ce-0d10-4ea4-a57d-6d81e9cb74a3" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121527Z:f9aa39ce-0d10-4ea4-a57d-6d81e9cb74a3" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: E8A95918DC0A4607B9578023592E9892 Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:26Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:26 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "524" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d/offers/aumatics.azure_managedservices\",\"name\":\"aumatics.azure_managedservices\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"aumatics.azure_managedservices\",\"specificPlanIdsLimitation\":null,\"eTag\":\"\\\"f3039b52-0000-0100-0000-65c222ad0000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":false}}", + "isContentBase64": false + } + }, + "Update-AzMarketplacePrivateStoreCollectionOffer+[NoContext]+UpdateExpanded+$PUT+https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d/offers/aumatics.azure_managedservices?api-version=2023-01-01+3": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d/offers/aumatics.azure_managedservices?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"eTag\": \"\\\"f3039b52-0000-0100-0000-65c222ad0000\\\"\",\r\n \"updateSuppressedDueIdempotence\": false\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "130" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Accept-Ranges": [ "bytes" ], + "Vary": [ "Accept-Encoding" ], + "Set-Cookie": [ "ARRAffinity=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;Secure;Domain=main.prod.marketplaceprivatestore.azure.com", "ARRAffinitySameSite=a3053b2a1619a6aa4b0e7e497e4fa01864cd730cd9c257837f8a0036d6c79b63;Path=/;HttpOnly;SameSite=None;Secure;Domain=main.prod.marketplaceprivatestore.azure.com" ], + "x-ms-ratelimit-remaining-tenant-writes": [ "1197" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-XSS-Protection": [ "1; mode=block" ], + "x-ms-version": [ "6.0.02586.90-5c77bed2" ], + "X-AspNet-Version": [ "4.0.30319" ], + "X-Powered-By": [ "ASP.NET" ], + "x-azure-ref": [ "20240206T121527Z-un93fkbvw50w5bbm67x1677wk800000009c0000000008mxd" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "x-ms-request-id": [ "0f6b58e5-5866-4ef1-b4f5-d82ba8f89c8c" ], + "x-ms-correlation-request-id": [ "0f6b58e5-5866-4ef1-b4f5-d82ba8f89c8c" ], + "x-ms-routing-request-id": [ "ISRAELCENTRAL:20240206T121529Z:0f6b58e5-5866-4ef1-b4f5-d82ba8f89c8c" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-MSEdge-Ref": [ "Ref A: 1DD883D762D84B88B62413A63072F4FD Ref B: MRS211050313051 Ref C: 2024-02-06T12:15:27Z" ], + "Date": [ "Tue, 06 Feb 2024 12:15:28 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "523" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/providers/Microsoft.Marketplace/privateStores/a260d38c-96cf-492d-a340-404d0c4b3ad6/collections/8c7a91db-cd41-43b6-af47-2e869654126d/offers/aumatics.azure_managedservices\",\"name\":\"aumatics.azure_managedservices\",\"type\":\"Microsoft.Marketplace/privateStores/collection/offers\",\"properties\":{\"uniqueOfferId\":\"aumatics.azure_managedservices\",\"specificPlanIdsLimitation\":null,\"eTag\":\"\\\"f3039b52-0000-0100-0000-65c222ad0000\\\"\",\"privateStoreId\":\"a260d38c-96cf-492d-a340-404d0c4b3ad6\",\"updateSuppressedDueIdempotence\":true}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Marketplace/Marketplace.Autorest/test/Update-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 b/src/Marketplace/Marketplace.Autorest/test/Update-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 new file mode 100644 index 000000000000..bbbb89c41ffe --- /dev/null +++ b/src/Marketplace/Marketplace.Autorest/test/Update-AzMarketplacePrivateStoreCollectionOffer.Tests.ps1 @@ -0,0 +1,26 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzMarketplacePrivateStoreCollectionOffer')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzMarketplacePrivateStoreCollectionOffer.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzMarketplacePrivateStoreCollectionOffer' { + It 'UpdateExpanded' { + + $acc = @{Accessibility = "azure_managedservices_professional"} + New-AzMarketplacePrivateStoreCollectionOffer -CollectionId 8c7a91db-cd41-43b6-af47-2e869654126d -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -OfferId aumatics.azure_managedservices -Plan $acc + + $res = Update-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId 8c7a91db-cd41-43b6-af47-2e869654126d -OfferId "aumatics.azure_managedservices" -SpecificPlanIdLimitation $null + $res | Should -Not -Be $null + } +} diff --git a/src/Marketplace/Marketplace.Autorest/test/env.json b/src/Marketplace/Marketplace.Autorest/test/env.json index 589ff4794a82..5449d556b770 100644 --- a/src/Marketplace/Marketplace.Autorest/test/env.json +++ b/src/Marketplace/Marketplace.Autorest/test/env.json @@ -1,4 +1,4 @@ { "Tenant": "a260d38c-96cf-492d-a340-404d0c4b3ad6", - "SubscriptionId": "1052ff5a-aa43-4ca1-bd18-010399494ce5" + "SubscriptionId": "1f58b5dd-313c-42ed-84fc-f1e351bba7fb" } diff --git a/src/Marketplace/Marketplace.Autorest/test/utils.ps1 b/src/Marketplace/Marketplace.Autorest/test/utils.ps1 index 6edc1596c0fd..c839f1fd847f 100644 --- a/src/Marketplace/Marketplace.Autorest/test/utils.ps1 +++ b/src/Marketplace/Marketplace.Autorest/test/utils.ps1 @@ -45,8 +45,11 @@ function setupEnv() { $env.Tenant = (Get-AzContext).Tenant.Id # For any resources you created for test, you should add it to $env here. $envFile = 'env.json' - Connect-AzAccount -UseDeviceAuthentication -SubscriptionId 1052ff5a-aa43-4ca1-bd18-010399494ce5 - New-AzMarketplacePrivateStoreCollection -CollectionName test1 -CollectionId 8c7a91db-cd41-43b6-af47-2e869654126d -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionsList 1052ff5a-aa43-4ca1-bd18-010399494ce5 + #Connect-AzAccount -UseDeviceAuthentication -Tenant a260d38c-96cf-492d-a340-404d0c4b3ad6 + #ApproveAllItemsCollection + New-AzMarketplacePrivateStoreCollection -CollectionName AllItemsPWRTest1 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionsList 1052ff5a-aa43-4ca1-bd18-010399494ce5 + #CopyOfferCollection + New-AzMarketplacePrivateStoreCollection -CollectionName CopyPWRTest1 -CollectionId 8c7a91db-cd41-43b6-af47-2e869654126d -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionsList 1052ff5a-aa43-4ca1-bd18-010399494ce5 if ($TestMode -eq 'live') { $envFile = 'localEnv.json' } @@ -54,8 +57,8 @@ function setupEnv() { } function cleanupEnv() { # Clean resources you create for testing - Remove-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 - Remove-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId 7f5402e4-e8f4-46bd-9bd1-8d27866a6065 + #Remove-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 + #Remove-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId 7f5402e4-e8f4-46bd-9bd1-8d27866a6065 Remove-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 Remove-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId 8c7a91db-cd41-43b6-af47-2e869654126d } diff --git a/src/Marketplace/Marketplace/Az.Marketplace.psd1 b/src/Marketplace/Marketplace/Az.Marketplace.psd1 index 1eaf995e0138..c0df73c1fbdf 100644 --- a/src/Marketplace/Marketplace/Az.Marketplace.psd1 +++ b/src/Marketplace/Marketplace/Az.Marketplace.psd1 @@ -3,7 +3,7 @@ # # Generated by: Microsoft Corporation # -# Generated on: 12/5/2023 +# Generated on: 2/7/2024 # @{ @@ -53,7 +53,7 @@ DotNetFrameworkVersion = '4.7.2' # ProcessorArchitecture = '' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.7.4'; }) +RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.15.1'; }) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = 'Marketplace.Autorest/bin/Az.Marketplace.private.dll', @@ -74,21 +74,34 @@ NestedModules = @('Marketplace.Autorest/Az.Marketplace.psm1', # 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', + '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' + 'Set-AzMarketplacePrivateStoreCollectionOffer', + 'Test-AzMarketplacePrivateStoreAnyExistingOffer', + 'Update-AzMarketplacePrivateStoreCollection', + 'Update-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 = 'Get-AzMarketplacePrivateStore', diff --git a/src/Marketplace/Marketplace/ChangeLog.md b/src/Marketplace/Marketplace/ChangeLog.md index ca46a22c45a0..8c72e3076548 100644 --- a/src/Marketplace/Marketplace/ChangeLog.md +++ b/src/Marketplace/Marketplace/ChangeLog.md @@ -18,6 +18,12 @@ - Additional information about change #1 --> ## Upcoming Release +* Added new features and capabilities to user and marketplace-admins: + - Approve offer and plans with subscription granularity. + - Enable\Disable Approve-All-Products on a collection. + - Fetch all subscriptions in a tenant. + - Get new plans notifications for the offers in the privatestore. + - Get all approved offers and plans for a user. ## Version 0.3.0 * Added new cmdlets: diff --git a/src/Marketplace/Marketplace/help/Az.Marketplace.md b/src/Marketplace/Marketplace/help/Az.Marketplace.md index b9b1bb0c65c6..5998e97a0ca3 100644 --- a/src/Marketplace/Marketplace/help/Az.Marketplace.md +++ b/src/Marketplace/Marketplace/help/Az.Marketplace.md @@ -11,19 +11,6 @@ Locale: en-US Commands to interact with Azure Marketplace. ## Az.Marketplace Cmdlets -### [Get-AzMarketplacePrivateStoreOffer](Get-AzMarketplacePrivateStoreOffer.md) -Get one or more private store's offer. - -### [Get-AzMarketplacePrivateStore](Get-AzMarketplacePrivateStore.md) -Get private store list - -### [Remove-AzMarketplacePrivateStoreOffer](Remove-AzMarketplacePrivateStoreOffer.md) -Remove an offer from private store. - -### [Set-AzMarketplacePrivateStoreOffer](Set-AzMarketplacePrivateStoreOffer.md) -Updates or creates offer for private store. - - ### [Copy-AzMarketplacePrivateStoreCollectionOffer](Copy-AzMarketplacePrivateStoreCollectionOffer.md) transferring offers (copy or move) from source collection to target collection(s) @@ -33,12 +20,18 @@ Tenant billing accounts names ### [Get-AzMarketplaceCollectionToSubscriptionMapping](Get-AzMarketplaceCollectionToSubscriptionMapping.md) For a given subscriptions list, the API will return a map of collections and the related subscriptions from the supplied list. +### [Get-AzMarketplacePrivateStore](Get-AzMarketplacePrivateStore.md) +Get private store list + ### [Get-AzMarketplacePrivateStoreCollection](Get-AzMarketplacePrivateStoreCollection.md) Gets private store collection ### [Get-AzMarketplacePrivateStoreCollectionOffer](Get-AzMarketplacePrivateStoreCollectionOffer.md) Gets information about a specific offer. +### [Get-AzMarketplacePrivateStoreOffer](Get-AzMarketplacePrivateStoreOffer.md) +Get one or more private store's offer. + ### [Get-AzMarketplacePrivateStoreV1](Get-AzMarketplacePrivateStoreV1.md) Get information about the private store @@ -60,6 +53,9 @@ Delete a collection from the given private store. ### [Remove-AzMarketplacePrivateStoreCollectionOffer](Remove-AzMarketplacePrivateStoreCollectionOffer.md) Deletes an offer from the given collection of private store. +### [Remove-AzMarketplacePrivateStoreOffer](Remove-AzMarketplacePrivateStoreOffer.md) +Remove an offer from private store. + ### [Set-AzMarketplaceBulkPrivateStoreCollectionAction](Set-AzMarketplaceBulkPrivateStoreCollectionAction.md) Perform an action on bulk collections @@ -71,3 +67,7 @@ Create or update private store collection ### [Set-AzMarketplacePrivateStoreCollectionOffer](Set-AzMarketplacePrivateStoreCollectionOffer.md) Update or add an offer to a specific collection of the private store. + +### [Set-AzMarketplacePrivateStoreOffer](Set-AzMarketplacePrivateStoreOffer.md) +Updates or creates offer for private store. + diff --git a/src/Marketplace/Marketplace/help/Copy-AzMarketplacePrivateStoreCollectionOffer.md b/src/Marketplace/Marketplace/help/Copy-AzMarketplacePrivateStoreCollectionOffer.md index dcce35267086..190b44832383 100644 --- a/src/Marketplace/Marketplace/help/Copy-AzMarketplacePrivateStoreCollectionOffer.md +++ b/src/Marketplace/Marketplace/help/Copy-AzMarketplacePrivateStoreCollectionOffer.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Marketplace-help.xml Module Name: Az.Marketplace online version: https://learn.microsoft.com/powershell/module/az.marketplace/copy-azmarketplaceprivatestorecollectionoffer schema: 2.0.0 @@ -16,26 +16,57 @@ transferring offers (copy or move) from source collection to target collection(s ``` Copy-AzMarketplacePrivateStoreCollectionOffer -CollectionId -PrivateStoreId [-OfferIdList ] [-Operation ] [-TargetCollection ] [-DefaultProfile ] - [-Confirm] [-WhatIf] [] + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` -### Transfer +### TransferViaJsonString ``` Copy-AzMarketplacePrivateStoreCollectionOffer -CollectionId -PrivateStoreId - -Payload [-DefaultProfile ] [-Confirm] [-WhatIf] [] + -JsonString [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` -### TransferViaIdentity +### TransferViaJsonFilePath ``` -Copy-AzMarketplacePrivateStoreCollectionOffer -InputObject - -Payload [-DefaultProfile ] [-Confirm] [-WhatIf] [] +Copy-AzMarketplacePrivateStoreCollectionOffer -CollectionId -PrivateStoreId + -JsonFilePath [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] + [] +``` + +### TransferViaIdentityPrivateStoreExpanded +``` +Copy-AzMarketplacePrivateStoreCollectionOffer -CollectionId + -PrivateStoreInputObject [-OfferIdList ] [-Operation ] + [-TargetCollection ] [-DefaultProfile ] [-ProgressAction ] [-WhatIf] + [-Confirm] [] +``` + +### TransferViaIdentityPrivateStore +``` +Copy-AzMarketplacePrivateStoreCollectionOffer -CollectionId + -PrivateStoreInputObject -Payload + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### Transfer +``` +Copy-AzMarketplacePrivateStoreCollectionOffer -CollectionId -PrivateStoreId + -Payload [-DefaultProfile ] [-ProgressAction ] + [-WhatIf] [-Confirm] [] ``` ### TransferViaIdentityExpanded ``` Copy-AzMarketplacePrivateStoreCollectionOffer -InputObject [-OfferIdList ] - [-Operation ] [-TargetCollection ] [-DefaultProfile ] [-Confirm] [-WhatIf] - [] + [-Operation ] [-TargetCollection ] [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### TransferViaIdentity +``` +Copy-AzMarketplacePrivateStoreCollectionOffer -InputObject + -Payload [-DefaultProfile ] [-ProgressAction ] + [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -64,7 +95,7 @@ The collection ID ```yaml Type: System.String -Parameter Sets: Transfer, TransferExpanded +Parameter Sets: TransferExpanded, TransferViaJsonString, TransferViaJsonFilePath, TransferViaIdentityPrivateStoreExpanded, TransferViaIdentityPrivateStore, Transfer Aliases: Required: True @@ -95,7 +126,7 @@ To construct, see NOTES section for INPUTOBJECT properties and create a hash tab ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity -Parameter Sets: TransferViaIdentity, TransferViaIdentityExpanded +Parameter Sets: TransferViaIdentityExpanded, TransferViaIdentity Aliases: Required: True @@ -105,12 +136,42 @@ Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` +### -JsonFilePath +Path of Json file supplied to the Transfer operation + +```yaml +Type: System.String +Parameter Sets: TransferViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Transfer operation + +```yaml +Type: System.String +Parameter Sets: TransferViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -OfferIdList Offers ids list to transfer from source collection to target collection(s) ```yaml Type: System.String[] -Parameter Sets: TransferExpanded, TransferViaIdentityExpanded +Parameter Sets: TransferExpanded, TransferViaIdentityPrivateStoreExpanded, TransferViaIdentityExpanded Aliases: Required: False @@ -125,7 +186,7 @@ Operation to perform (For example: Copy or Move) ```yaml Type: System.String -Parameter Sets: TransferExpanded, TransferViaIdentityExpanded +Parameter Sets: TransferExpanded, TransferViaIdentityPrivateStoreExpanded, TransferViaIdentityExpanded Aliases: Required: False @@ -140,8 +201,8 @@ Transfer offers properties To construct, see NOTES section for PAYLOAD properties and create a hash table. ```yaml -Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ITransferOffersProperties -Parameter Sets: Transfer, TransferViaIdentity +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ITransferOffersProperties +Parameter Sets: TransferViaIdentityPrivateStore, Transfer, TransferViaIdentity Aliases: Required: True @@ -156,12 +217,43 @@ The store ID - must use the tenant ID ```yaml Type: System.String -Parameter Sets: Transfer, TransferExpanded +Parameter Sets: TransferExpanded, TransferViaJsonString, TransferViaJsonFilePath, Transfer +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: TransferViaIdentityPrivateStoreExpanded, TransferViaIdentityPrivateStore Aliases: Required: True Position: Named Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -171,7 +263,7 @@ Target collections ids ```yaml Type: System.String[] -Parameter Sets: TransferExpanded, TransferViaIdentityExpanded +Parameter Sets: TransferExpanded, TransferViaIdentityPrivateStoreExpanded, TransferViaIdentityExpanded Aliases: Required: False @@ -248,4 +340,3 @@ PAYLOAD ``: Transfer offers properties - `[TargetCollection ]`: Target collections ids ## RELATED LINKS - diff --git a/src/Marketplace/Marketplace/help/Disable-AzMarketplacePrivateStoreCollectionAllItem.md b/src/Marketplace/Marketplace/help/Disable-AzMarketplacePrivateStoreCollectionAllItem.md new file mode 100644 index 000000000000..1722e006ab5a --- /dev/null +++ b/src/Marketplace/Marketplace/help/Disable-AzMarketplacePrivateStoreCollectionAllItem.md @@ -0,0 +1,204 @@ +--- +external help file: Az.Marketplace-help.xml +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/disable-azmarketplaceprivatestorecollectionallitem +schema: 2.0.0 +--- + +# Disable-AzMarketplacePrivateStoreCollectionAllItem + +## SYNOPSIS +Disable approve all items for the collection. + +## SYNTAX + +### Disable (Default) +``` +Disable-AzMarketplacePrivateStoreCollectionAllItem -CollectionId -PrivateStoreId + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### DisableViaIdentityPrivateStore +``` +Disable-AzMarketplacePrivateStoreCollectionAllItem -CollectionId + -PrivateStoreInputObject [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### DisableViaIdentity +``` +Disable-AzMarketplacePrivateStoreCollectionAllItem -InputObject + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Disable approve all items for the collection. + +## EXAMPLES + +### EXAMPLE 1 +``` +Disable-AzMarketplacePrivateStoreCollectionAllItem -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 +``` + +## PARAMETERS + +### -CollectionId +The collection ID + +```yaml +Type: String +Parameter Sets: Disable, DisableViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: IMarketplaceIdentity +Parameter Sets: DisableViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: String +Parameter Sets: Disable +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: IMarketplaceIdentity +Parameter Sets: DisableViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[AdminRequestApprovalId \\]: The admin request approval ID to get create or update + \[CollectionId \\]: The collection ID + \[Id \\]: Resource identity path + \[OfferId \\]: The offer ID to update or delete + \[PrivateStoreId \\]: The store ID - must use the tenant ID + \[RequestApprovalId \\]: The request approval ID to get create or update + +PRIVATESTOREINPUTOBJECT \: Identity Parameter + \[AdminRequestApprovalId \\]: The admin request approval ID to get create or update + \[CollectionId \\]: The collection ID + \[Id \\]: Resource identity path + \[OfferId \\]: The offer ID to update or delete + \[PrivateStoreId \\]: The store ID - must use the tenant ID + \[RequestApprovalId \\]: The request approval ID to get create or update + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.marketplace/disable-azmarketplaceprivatestorecollectionallitem](https://learn.microsoft.com/powershell/module/az.marketplace/disable-azmarketplaceprivatestorecollectionallitem) + diff --git a/src/Marketplace/Marketplace/help/Enable-AzMarketplacePrivateStoreCollectionAllItem.md b/src/Marketplace/Marketplace/help/Enable-AzMarketplacePrivateStoreCollectionAllItem.md new file mode 100644 index 000000000000..fcd0e1173d74 --- /dev/null +++ b/src/Marketplace/Marketplace/help/Enable-AzMarketplacePrivateStoreCollectionAllItem.md @@ -0,0 +1,204 @@ +--- +external help file: Az.Marketplace-help.xml +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/enable-azmarketplaceprivatestorecollectionallitem +schema: 2.0.0 +--- + +# Enable-AzMarketplacePrivateStoreCollectionAllItem + +## SYNOPSIS +Delete all existing offers from the collection and enable approve all items. + +## SYNTAX + +### Approve (Default) +``` +Enable-AzMarketplacePrivateStoreCollectionAllItem -CollectionId -PrivateStoreId + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### ApproveViaIdentityPrivateStore +``` +Enable-AzMarketplacePrivateStoreCollectionAllItem -CollectionId + -PrivateStoreInputObject [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### ApproveViaIdentity +``` +Enable-AzMarketplacePrivateStoreCollectionAllItem -InputObject + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Delete all existing offers from the collection and enable approve all items. + +## EXAMPLES + +### EXAMPLE 1 +``` +Enable-AzMarketplacePrivateStoreCollectionAllItem -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa0188 +``` + +## PARAMETERS + +### -CollectionId +The collection ID + +```yaml +Type: String +Parameter Sets: Approve, ApproveViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: IMarketplaceIdentity +Parameter Sets: ApproveViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: String +Parameter Sets: Approve +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: IMarketplaceIdentity +Parameter Sets: ApproveViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[AdminRequestApprovalId \\]: The admin request approval ID to get create or update + \[CollectionId \\]: The collection ID + \[Id \\]: Resource identity path + \[OfferId \\]: The offer ID to update or delete + \[PrivateStoreId \\]: The store ID - must use the tenant ID + \[RequestApprovalId \\]: The request approval ID to get create or update + +PRIVATESTOREINPUTOBJECT \: Identity Parameter + \[AdminRequestApprovalId \\]: The admin request approval ID to get create or update + \[CollectionId \\]: The collection ID + \[Id \\]: Resource identity path + \[OfferId \\]: The offer ID to update or delete + \[PrivateStoreId \\]: The store ID - must use the tenant ID + \[RequestApprovalId \\]: The request approval ID to get create or update + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.marketplace/enable-azmarketplaceprivatestorecollectionallitem](https://learn.microsoft.com/powershell/module/az.marketplace/enable-azmarketplaceprivatestorecollectionallitem) + diff --git a/src/Marketplace/Marketplace/help/Get-AzMarketplaceBillingPrivateStoreAccount.md b/src/Marketplace/Marketplace/help/Get-AzMarketplaceBillingPrivateStoreAccount.md index 0b952f280bdc..745bbe25336e 100644 --- a/src/Marketplace/Marketplace/help/Get-AzMarketplaceBillingPrivateStoreAccount.md +++ b/src/Marketplace/Marketplace/help/Get-AzMarketplaceBillingPrivateStoreAccount.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Marketplace-help.xml Module Name: Az.Marketplace online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplacebillingprivatestoreaccount schema: 2.0.0 @@ -14,14 +14,14 @@ Tenant billing accounts names ### Billing (Default) ``` -Get-AzMarketplaceBillingPrivateStoreAccount -PrivateStoreId [-DefaultProfile ] [-Confirm] - [-WhatIf] [] +Get-AzMarketplaceBillingPrivateStoreAccount -PrivateStoreId [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ### BillingViaIdentity ``` Get-AzMarketplaceBillingPrivateStoreAccount -InputObject [-DefaultProfile ] - [-Confirm] [-WhatIf] [] + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -29,7 +29,7 @@ Tenant billing accounts names ## EXAMPLES -### Example 1: Returns the billing account of a private store +### Example 1: Returns the billing account of a private store ```powershell Get-AzMarketplaceBillingPrivateStoreAccount -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a ``` @@ -88,6 +88,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Confirm Prompts you for confirmation before running the cmdlet. @@ -148,4 +163,3 @@ INPUTOBJECT ``: Identity Parameter - `[RequestApprovalId ]`: The request approval ID to get create or update ## RELATED LINKS - diff --git a/src/Marketplace/Marketplace/help/Get-AzMarketplaceCollectionToSubscriptionMapping.md b/src/Marketplace/Marketplace/help/Get-AzMarketplaceCollectionToSubscriptionMapping.md index 3eb53951c33d..2e64eab84be6 100644 --- a/src/Marketplace/Marketplace/help/Get-AzMarketplaceCollectionToSubscriptionMapping.md +++ b/src/Marketplace/Marketplace/help/Get-AzMarketplaceCollectionToSubscriptionMapping.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Marketplace-help.xml Module Name: Az.Marketplace online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplacecollectiontosubscriptionmapping schema: 2.0.0 @@ -15,27 +15,40 @@ For a given subscriptions list, the API will return a map of collections and the ### CollectionsExpanded (Default) ``` Get-AzMarketplaceCollectionToSubscriptionMapping -PrivateStoreId [-SubscriptionId ] - [-DefaultProfile ] [-Confirm] [-WhatIf] [] + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### CollectionsViaJsonString +``` +Get-AzMarketplaceCollectionToSubscriptionMapping -PrivateStoreId -JsonString + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### CollectionsViaJsonFilePath +``` +Get-AzMarketplaceCollectionToSubscriptionMapping -PrivateStoreId -JsonFilePath + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ### Collections ``` Get-AzMarketplaceCollectionToSubscriptionMapping -PrivateStoreId - -Payload [-DefaultProfile ] [-Confirm] [-WhatIf] - [] + -Payload [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` -### CollectionsViaIdentity +### CollectionsViaIdentityExpanded ``` Get-AzMarketplaceCollectionToSubscriptionMapping -InputObject - -Payload [-DefaultProfile ] [-Confirm] [-WhatIf] - [] + [-SubscriptionId ] [-DefaultProfile ] [-ProgressAction ] [-WhatIf] + [-Confirm] [] ``` -### CollectionsViaIdentityExpanded +### CollectionsViaIdentity ``` Get-AzMarketplaceCollectionToSubscriptionMapping -InputObject - [-SubscriptionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] + -Payload [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -79,7 +92,7 @@ To construct, see NOTES section for INPUTOBJECT properties and create a hash tab ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity -Parameter Sets: CollectionsViaIdentity, CollectionsViaIdentityExpanded +Parameter Sets: CollectionsViaIdentityExpanded, CollectionsViaIdentity Aliases: Required: True @@ -89,12 +102,42 @@ Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` +### -JsonFilePath +Path of Json file supplied to the Collections operation + +```yaml +Type: System.String +Parameter Sets: CollectionsViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Collections operation + +```yaml +Type: System.String +Parameter Sets: CollectionsViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Payload The subscriptions list to get the related collections To construct, see NOTES section for PAYLOAD properties and create a hash table. ```yaml -Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.ICollectionsToSubscriptionsMappingPayload +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionsToSubscriptionsMappingPayload Parameter Sets: Collections, CollectionsViaIdentity Aliases: @@ -110,7 +153,7 @@ The store ID - must use the tenant ID ```yaml Type: System.String -Parameter Sets: Collections, CollectionsExpanded +Parameter Sets: CollectionsExpanded, CollectionsViaJsonString, CollectionsViaJsonFilePath, Collections Aliases: Required: True @@ -120,6 +163,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -SubscriptionId Subscriptions ids list @@ -200,4 +258,3 @@ PAYLOAD ``: The subscriptions list to - `[SubscriptionId ]`: Subscriptions ids list ## RELATED LINKS - diff --git a/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStore.md b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStore.md index ee119221cb42..975c4b002e90 100644 --- a/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStore.md +++ b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStore.md @@ -1,7 +1,7 @@ --- external help file: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.dll-Help.xml Module Name: Az.Marketplace -online version:https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestore +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestore schema: 2.0.0 --- @@ -13,7 +13,8 @@ Get private store list ## SYNTAX ``` -Get-AzMarketplacePrivateStore [-DefaultProfile ] [] +Get-AzMarketplacePrivateStore [-DefaultProfile ] [-ProgressAction ] + [] ``` ## DESCRIPTION @@ -54,6 +55,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.md b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.md new file mode 100644 index 000000000000..17b451b9c935 --- /dev/null +++ b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreAllSubscriptionInTenant.md @@ -0,0 +1,174 @@ +--- +external help file: Az.Marketplace-help.xml +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreallsubscriptionintenant +schema: 2.0.0 +--- + +# Get-AzMarketplacePrivateStoreAllSubscriptionInTenant + +## SYNOPSIS +Fetch all subscriptions in tenant, only for marketplace admin + +## SYNTAX + +### Fetch (Default) +``` +Get-AzMarketplacePrivateStoreAllSubscriptionInTenant -PrivateStoreId [-NextPageToken ] + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### FetchViaIdentity +``` +Get-AzMarketplacePrivateStoreAllSubscriptionInTenant -InputObject + [-NextPageToken ] [-DefaultProfile ] [-ProgressAction ] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION +Fetch all subscriptions in tenant, only for marketplace admin + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzMarketplacePrivateStoreAllSubscriptionInTenant -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: IMarketplaceIdentity +Parameter Sets: FetchViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NextPageToken +The skip token to get the next page. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: String +Parameter Sets: Fetch +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsResponse +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[AdminRequestApprovalId \\]: The admin request approval ID to get create or update + \[CollectionId \\]: The collection ID + \[Id \\]: Resource identity path + \[OfferId \\]: The offer ID to update or delete + \[PrivateStoreId \\]: The store ID - must use the tenant ID + \[RequestApprovalId \\]: The request approval ID to get create or update + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreallsubscriptionintenant](https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreallsubscriptionintenant) + diff --git a/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreCollection.md b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreCollection.md index 286355f8e31a..3eadc94f5f15 100644 --- a/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreCollection.md +++ b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreCollection.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Marketplace-help.xml Module Name: Az.Marketplace online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollection schema: 2.0.0 @@ -15,19 +15,25 @@ Gets private store collection ### List (Default) ``` Get-AzMarketplacePrivateStoreCollection -PrivateStoreId [-DefaultProfile ] - [] + [-ProgressAction ] [] +``` + +### GetViaIdentityPrivateStore +``` +Get-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreInputObject + [-DefaultProfile ] [-ProgressAction ] [] ``` ### Get ``` Get-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreId - [-DefaultProfile ] [] + [-DefaultProfile ] [-ProgressAction ] [] ``` ### GetViaIdentity ``` Get-AzMarketplacePrivateStoreCollection -InputObject [-DefaultProfile ] - [] + [-ProgressAction ] [] ``` ## DESCRIPTION @@ -45,7 +51,6 @@ Name SystemDataCreatedAt SystemDataCreatedBy Sy ---- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- 53425a7b-4ac1-4729-8340-e1da5046212c User 8/23/2021 6:06:52 AM User 23455a7b-4ac1-4729-8340-e1da5046212c 12/1/2021 9:01:33 PM User 12/1/2021 9:01:33 PM User - ``` This command gets list of private store collections @@ -57,7 +62,7 @@ The collection ID ```yaml Type: System.String -Parameter Sets: Get +Parameter Sets: GetViaIdentityPrivateStore, Get Aliases: Required: True @@ -103,7 +108,7 @@ The store ID - must use the tenant ID ```yaml Type: System.String -Parameter Sets: Get, List +Parameter Sets: List, Get Aliases: Required: True @@ -113,6 +118,37 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: GetViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). @@ -144,4 +180,3 @@ INPUTOBJECT ``: Identity Parameter - `[RequestApprovalId ]`: The request approval ID to get create or update ## RELATED LINKS - diff --git a/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.md b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.md new file mode 100644 index 000000000000..7cdaedae2362 --- /dev/null +++ b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreCollectionMapOffersToContext.md @@ -0,0 +1,153 @@ +--- +external help file: Az.Marketplace-help.xml +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollectionmapofferstocontext +schema: 2.0.0 +--- + +# Get-AzMarketplacePrivateStoreCollectionMapOffersToContext + +## SYNOPSIS +Get a list of all offers in the given collection according to the required contexts. + +## SYNTAX + +``` +Get-AzMarketplacePrivateStoreCollectionMapOffersToContext -CollectionId -PrivateStoreId + [-SubscriptionId ] [-DefaultProfile ] [-ProgressAction ] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION +Get a list of all offers in the given collection according to the required contexts. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzMarketplacePrivateStoreCollectionMapOffersToContext -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionId 1f58b5dd-313c-42ed-84fc-f1e351bba7fb,ab3de7bc-7a6e-4e9f-a34a-f6922df453e4 +``` + +## PARAMETERS + +### -CollectionId +The collection ID + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Subscription ids list + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollectionOffersByContext +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollectionmapofferstocontext](https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollectionmapofferstocontext) + diff --git a/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreCollectionOffer.md b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreCollectionOffer.md index 4dedfd3614e6..8d595e262f4a 100644 --- a/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreCollectionOffer.md +++ b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreCollectionOffer.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Marketplace-help.xml Module Name: Az.Marketplace online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollectionoffer schema: 2.0.0 @@ -15,19 +15,32 @@ Gets information about a specific offer. ### List (Default) ``` Get-AzMarketplacePrivateStoreCollectionOffer -CollectionId -PrivateStoreId - [-DefaultProfile ] [] + [-DefaultProfile ] [-ProgressAction ] [] +``` + +### GetViaIdentityPrivateStore +``` +Get-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId + -PrivateStoreInputObject [-DefaultProfile ] + [-ProgressAction ] [] ``` ### Get ``` Get-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId -PrivateStoreId - [-DefaultProfile ] [] + [-DefaultProfile ] [-ProgressAction ] [] +``` + +### GetViaIdentityCollection +``` +Get-AzMarketplacePrivateStoreCollectionOffer -OfferId -CollectionInputObject + [-DefaultProfile ] [-ProgressAction ] [] ``` ### GetViaIdentity ``` Get-AzMarketplacePrivateStoreCollectionOffer -InputObject [-DefaultProfile ] - [] + [-ProgressAction ] [] ``` ## DESCRIPTION @@ -57,7 +70,7 @@ The collection ID ```yaml Type: System.String -Parameter Sets: Get, List +Parameter Sets: List, GetViaIdentityPrivateStore, Get Aliases: Required: True @@ -67,6 +80,22 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -CollectionInputObject +Identity Parameter +To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: GetViaIdentityCollection +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -DefaultProfile The credentials, account, tenant, and subscription used for communication with Azure. @@ -103,7 +132,7 @@ The offer ID to update or delete ```yaml Type: System.String -Parameter Sets: Get +Parameter Sets: GetViaIdentityPrivateStore, Get, GetViaIdentityCollection Aliases: Required: True @@ -118,12 +147,43 @@ The store ID - must use the tenant ID ```yaml Type: System.String -Parameter Sets: Get, List +Parameter Sets: List, Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: GetViaIdentityPrivateStore Aliases: Required: True Position: Named Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -157,4 +217,3 @@ INPUTOBJECT ``: Identity Parameter - `[RequestApprovalId ]`: The request approval ID to get create or update ## RELATED LINKS - diff --git a/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreCollectionRule.md b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreCollectionRule.md new file mode 100644 index 000000000000..ac5f35ba6594 --- /dev/null +++ b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreCollectionRule.md @@ -0,0 +1,204 @@ +--- +external help file: Az.Marketplace-help.xml +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollectionrule +schema: 2.0.0 +--- + +# Get-AzMarketplacePrivateStoreCollectionRule + +## SYNOPSIS +Get a list of all private store rules in the given private store and collection + +## SYNTAX + +### Query (Default) +``` +Get-AzMarketplacePrivateStoreCollectionRule -CollectionId -PrivateStoreId + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### QueryViaIdentityPrivateStore +``` +Get-AzMarketplacePrivateStoreCollectionRule -CollectionId + -PrivateStoreInputObject [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### QueryViaIdentity +``` +Get-AzMarketplacePrivateStoreCollectionRule -InputObject [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Get a list of all private store rules in the given private store and collection + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzMarketplacePrivateStoreCollectionRule -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId a260d38c-96cf-492d-a340-404d0c4b3ad6 +``` + +## PARAMETERS + +### -CollectionId +The collection ID + +```yaml +Type: String +Parameter Sets: Query, QueryViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: IMarketplaceIdentity +Parameter Sets: QueryViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: String +Parameter Sets: Query +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: IMarketplaceIdentity +Parameter Sets: QueryViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[AdminRequestApprovalId \\]: The admin request approval ID to get create or update + \[CollectionId \\]: The collection ID + \[Id \\]: Resource identity path + \[OfferId \\]: The offer ID to update or delete + \[PrivateStoreId \\]: The store ID - must use the tenant ID + \[RequestApprovalId \\]: The request approval ID to get create or update + +PRIVATESTOREINPUTOBJECT \: Identity Parameter + \[AdminRequestApprovalId \\]: The admin request approval ID to get create or update + \[CollectionId \\]: The collection ID + \[Id \\]: Resource identity path + \[OfferId \\]: The offer ID to update or delete + \[PrivateStoreId \\]: The store ID - must use the tenant ID + \[RequestApprovalId \\]: The request approval ID to get create or update + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollectionrule](https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorecollectionrule) + diff --git a/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreNewPlanNotification.md b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreNewPlanNotification.md new file mode 100644 index 000000000000..491031dda58e --- /dev/null +++ b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreNewPlanNotification.md @@ -0,0 +1,122 @@ +--- +external help file: Az.Marketplace-help.xml +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorenewplannotification +schema: 2.0.0 +--- + +# Get-AzMarketplacePrivateStoreNewPlanNotification + +## SYNOPSIS +List new plans notifications + +## SYNTAX + +``` +Get-AzMarketplacePrivateStoreNewPlanNotification -PrivateStoreId [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +List new plans notifications + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzMarketplacePrivateStoreNewPlanNotification -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.INewPlansNotificationsList +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorenewplannotification](https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorenewplannotification) + diff --git a/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreOffer.md b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreOffer.md index 4a7f14b5cfb6..8f4d0ba759f2 100644 --- a/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreOffer.md +++ b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreOffer.md @@ -1,7 +1,7 @@ --- external help file: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.dll-Help.xml Module Name: Az.Marketplace -online version:https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreoffer +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreoffer schema: 2.0.0 --- @@ -13,13 +13,14 @@ Get one or more private store's offer. ## SYNTAX ``` -Get-AzMarketplacePrivateStoreOffer -PrivateStoreId [-OfferId ] - [-DefaultProfile ] [] +Get-AzMarketplacePrivateStoreOffer -PrivateStoreId [-OfferId ] [-SubscriptionId ] + [-DefaultProfile ] [-ProgressAction ] [] ``` ## DESCRIPTION Get one or more private store's offer with public + private plans that were added under tenant scope. If subscription id is presents, get one or more private store's offer with private plans only under subscription scope + ## EXAMPLES ### Example 1 @@ -136,7 +137,6 @@ Type : Microsoft.Marketplace/privateStores/offers Get private store's offer with private plans only that was been added under tenant scope. - ## PARAMETERS ### -DefaultProfile @@ -184,6 +184,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -SubscriptionId Azure Marketplace subscription id diff --git a/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreSubscription.md b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreSubscription.md new file mode 100644 index 000000000000..641d9589cac2 --- /dev/null +++ b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreSubscription.md @@ -0,0 +1,122 @@ +--- +external help file: Az.Marketplace-help.xml +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoresubscription +schema: 2.0.0 +--- + +# Get-AzMarketplacePrivateStoreSubscription + +## SYNOPSIS +List all the subscriptions in the private store context + +## SYNTAX + +``` +Get-AzMarketplacePrivateStoreSubscription -PrivateStoreId [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +List all the subscriptions in the private store context + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzMarketplacePrivateStoreSubscription -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ISubscriptionsContextList +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoresubscription](https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoresubscription) + diff --git a/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreUserOffer.md b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreUserOffer.md new file mode 100644 index 000000000000..c7136a056a95 --- /dev/null +++ b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreUserOffer.md @@ -0,0 +1,190 @@ +--- +external help file: Az.Marketplace-help.xml +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreuseroffer +schema: 2.0.0 +--- + +# Get-AzMarketplacePrivateStoreUserOffer + +## SYNOPSIS +List of user's approved offers for the provided offers and subscriptions + +## SYNTAX + +### QueryExpanded (Default) +``` +Get-AzMarketplacePrivateStoreUserOffer -PrivateStoreId [-OfferId ] + [-SubscriptionId ] [-DefaultProfile ] [-ProgressAction ] [-WhatIf] + [-Confirm] [] +``` + +### QueryViaIdentityExpanded +``` +Get-AzMarketplacePrivateStoreUserOffer -InputObject [-OfferId ] + [-SubscriptionId ] [-DefaultProfile ] [-ProgressAction ] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION +List of user's approved offers for the provided offers and subscriptions + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzMarketplacePrivateStoreUserOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -OfferId aumatics.azure_managedservices -SubscriptionId 1f58b5dd-313c-42ed-84fc-f1e351bba7fb +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: IMarketplaceIdentity +Parameter Sets: QueryViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -OfferId +List of offer IDs + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: String +Parameter Sets: QueryExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +List of subscription IDs + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IQueryOffers +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[AdminRequestApprovalId \\]: The admin request approval ID to get create or update + \[CollectionId \\]: The collection ID + \[Id \\]: Resource identity path + \[OfferId \\]: The offer ID to update or delete + \[PrivateStoreId \\]: The store ID - must use the tenant ID + \[RequestApprovalId \\]: The request approval ID to get create or update + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreuseroffer](https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreuseroffer) + diff --git a/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreUserRule.md b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreUserRule.md new file mode 100644 index 000000000000..d657c6cfafa6 --- /dev/null +++ b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreUserRule.md @@ -0,0 +1,173 @@ +--- +external help file: Az.Marketplace-help.xml +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreuserrule +schema: 2.0.0 +--- + +# Get-AzMarketplacePrivateStoreUserRule + +## SYNOPSIS +All rules approved in the private store that are relevant for user subscriptions + +## SYNTAX + +### QueryExpanded (Default) +``` +Get-AzMarketplacePrivateStoreUserRule -PrivateStoreId [-SubscriptionId ] + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### QueryViaIdentityExpanded +``` +Get-AzMarketplacePrivateStoreUserRule -InputObject [-SubscriptionId ] + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +All rules approved in the private store that are relevant for user subscriptions + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzMarketplacePrivateStoreUserRule -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -SubscriptionId 1f58b5dd-313c-42ed-84fc-f1e351bba7fb +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: IMarketplaceIdentity +Parameter Sets: QueryViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: String +Parameter Sets: QueryExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +List of subscription IDs + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRuleListResponse +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[AdminRequestApprovalId \\]: The admin request approval ID to get create or update + \[CollectionId \\]: The collection ID + \[Id \\]: Resource identity path + \[OfferId \\]: The offer ID to update or delete + \[PrivateStoreId \\]: The store ID - must use the tenant ID + \[RequestApprovalId \\]: The request approval ID to get create or update + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreuserrule](https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestoreuserrule) + diff --git a/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreV1.md b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreV1.md index 8bb174c14d5c..af27db557d35 100644 --- a/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreV1.md +++ b/src/Marketplace/Marketplace/help/Get-AzMarketplacePrivateStoreV1.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Marketplace-help.xml Module Name: Az.Marketplace online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplaceprivatestorev1 schema: 2.0.0 @@ -14,18 +14,20 @@ Get information about the private store ### List (Default) ``` -Get-AzMarketplacePrivateStoreV1 [-UseCache ] [-DefaultProfile ] [] +Get-AzMarketplacePrivateStoreV1 [-UseCache ] [-DefaultProfile ] + [-ProgressAction ] [] ``` ### Get ``` -Get-AzMarketplacePrivateStoreV1 -Id [-DefaultProfile ] [] +Get-AzMarketplacePrivateStoreV1 -Id [-DefaultProfile ] [-ProgressAction ] + [] ``` ### GetViaIdentity ``` Get-AzMarketplacePrivateStoreV1 -InputObject [-DefaultProfile ] - [] + [-ProgressAction ] [] ``` ## DESCRIPTION @@ -46,7 +48,6 @@ a260d38c-96cf-492d-a340-404d0c4b3ad6 Use This command Gets the private store details - ## PARAMETERS ### -DefaultProfile @@ -95,6 +96,21 @@ Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -UseCache Determines if to use cache or DB for serving this request @@ -139,4 +155,3 @@ INPUTOBJECT ``: Identity Parameter - `[RequestApprovalId ]`: The request approval ID to get create or update ## RELATED LINKS - diff --git a/src/Marketplace/Marketplace/help/Get-AzMarketplaceQueryPrivateStoreOffer.md b/src/Marketplace/Marketplace/help/Get-AzMarketplaceQueryPrivateStoreOffer.md index 9d0f18ad1ebb..45583cee61d9 100644 --- a/src/Marketplace/Marketplace/help/Get-AzMarketplaceQueryPrivateStoreOffer.md +++ b/src/Marketplace/Marketplace/help/Get-AzMarketplaceQueryPrivateStoreOffer.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Marketplace-help.xml Module Name: Az.Marketplace online version: https://learn.microsoft.com/powershell/module/az.marketplace/get-azmarketplacequeryprivatestoreoffer schema: 2.0.0 @@ -14,14 +14,14 @@ List of offers, regardless the collections ### Query (Default) ``` -Get-AzMarketplaceQueryPrivateStoreOffer -PrivateStoreId [-DefaultProfile ] [-Confirm] - [-WhatIf] [] +Get-AzMarketplaceQueryPrivateStoreOffer -PrivateStoreId [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ### QueryViaIdentity ``` Get-AzMarketplaceQueryPrivateStoreOffer -InputObject [-DefaultProfile ] - [-Confirm] [-WhatIf] [] + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -42,7 +42,6 @@ CreatedAt ETag ModifiedAt OfferDisplayName Pri "ef00ab05-0000-0100-0000-61a5f12f0000" 3ac32d8c-e888-4dc6-b4ff-be4d755af13a {RedHatEnterpriseLinux72-ARM} RedHat.RHEL_7 "f300276b-0000-0100-0000-61a7e1af0000" 3ac32d8c-e888-4dc6-b4ff-be4d755af13a {128technology_conductor_hourly_427, 128technology_conductor_hourly_452} 128technolog… "f300296b-0000-0100-0000-61a7e1af0000" 3ac32d8c-e888-4dc6-b4ff-be4d755af13a {128technology_router_100_hourly_427, 128technology_router_100_hourly_452} 128technolog… - ``` This command returns private store offer regardless of collections @@ -95,6 +94,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Confirm Prompts you for confirmation before running the cmdlet. @@ -155,4 +169,3 @@ INPUTOBJECT ``: Identity Parameter - `[RequestApprovalId ]`: The request approval ID to get create or update ## RELATED LINKS - diff --git a/src/Marketplace/Marketplace/help/New-AzMarketplacePrivateStore.md b/src/Marketplace/Marketplace/help/New-AzMarketplacePrivateStore.md index b92a4804a439..dddfa2bd8445 100644 --- a/src/Marketplace/Marketplace/help/New-AzMarketplacePrivateStore.md +++ b/src/Marketplace/Marketplace/help/New-AzMarketplacePrivateStore.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Marketplace-help.xml Module Name: Az.Marketplace online version: https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestore schema: 2.0.0 @@ -12,11 +12,24 @@ Changes private store properties ## SYNTAX +### CreateExpanded (Default) ``` -New-AzMarketplacePrivateStore -Id [-Availability ] [-Branding ] - [-ETag ] [-IsGov] [-NotificationSettingRecipient ] - [-NotificationSettingSendToAllMarketplaceAdmin] [-PrivateStoreName ] [-TenantId ] - [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +New-AzMarketplacePrivateStore -Id [-Availability ] [-Branding ] [-ETag ] + [-IsGov] [-NotificationSettingRecipient ] [-NotificationSettingSendToAllMarketplaceAdmin] + [-PrivateStoreName ] [-TenantId ] [-DefaultProfile ] [-PassThru] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### CreateViaJsonFilePath +``` +New-AzMarketplacePrivateStore -Id -JsonFilePath [-DefaultProfile ] [-PassThru] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### CreateViaJsonString +``` +New-AzMarketplacePrivateStore -Id -JsonString [-DefaultProfile ] [-PassThru] + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -37,8 +50,8 @@ This command changes private store properties. Indicates private store availability ```yaml -Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability -Parameter Sets: (All) +Type: System.String +Parameter Sets: CreateExpanded Aliases: Required: False @@ -53,7 +66,7 @@ Gets or sets list of branding characteristics ```yaml Type: System.Collections.Hashtable -Parameter Sets: (All) +Parameter Sets: CreateExpanded Aliases: Required: False @@ -83,7 +96,7 @@ Identifier for purposes of race condition ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: CreateExpanded Aliases: Required: False @@ -113,7 +126,7 @@ Is government ```yaml Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) +Parameter Sets: CreateExpanded Aliases: Required: False @@ -123,13 +136,43 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -JsonFilePath +Path of Json file supplied to the Create operation + +```yaml +Type: System.String +Parameter Sets: CreateViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Create operation + +```yaml +Type: System.String +Parameter Sets: CreateViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -NotificationSettingRecipient Gets or sets list of notified recipients for new requests To construct, see NOTES section for NOTIFICATIONSETTINGRECIPIENT properties and create a hash table. ```yaml -Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[] -Parameter Sets: (All) +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient[] +Parameter Sets: CreateExpanded Aliases: Required: False @@ -144,7 +187,7 @@ Gets or sets whether to send email to all marketplace admins for new requests ```yaml Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) +Parameter Sets: CreateExpanded Aliases: Required: False @@ -174,7 +217,7 @@ Private Store Name ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: CreateExpanded Aliases: Required: False @@ -184,12 +227,27 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -TenantId Tenant id ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: CreateExpanded Aliases: Required: False @@ -252,4 +310,3 @@ NOTIFICATIONSETTINGRECIPIENT : Gets or sets list of notified recip - `[PrincipalId ]`: Principal ID ## RELATED LINKS - diff --git a/src/Marketplace/Marketplace/help/New-AzMarketplacePrivateStoreCollection.md b/src/Marketplace/Marketplace/help/New-AzMarketplacePrivateStoreCollection.md index b16d822dc7ba..c2b2353a865e 100644 --- a/src/Marketplace/Marketplace/help/New-AzMarketplacePrivateStoreCollection.md +++ b/src/Marketplace/Marketplace/help/New-AzMarketplacePrivateStoreCollection.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Marketplace-help.xml Module Name: Az.Marketplace online version: https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollection schema: 2.0.0 @@ -12,10 +12,37 @@ Create or update private store collection ## SYNTAX +### CreateExpanded (Default) ``` New-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreId [-AllSubscription] [-Claim ] [-CollectionName ] [-Enabled] [-SubscriptionsList ] - [-DefaultProfile ] [-Confirm] [-WhatIf] [] + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### CreateViaJsonString +``` +New-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreId -JsonString + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### CreateViaJsonFilePath +``` +New-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreId -JsonFilePath + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### CreateViaIdentityPrivateStoreExpanded +``` +New-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreInputObject + [-AllSubscription] [-Claim ] [-CollectionName ] [-Enabled] [-SubscriptionsList ] + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### CreateViaIdentityPrivateStore +``` +New-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreInputObject + -Payload [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -43,7 +70,7 @@ Indicating whether all subscriptions are selected (=true) or not (=false). ```yaml Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaIdentityPrivateStoreExpanded Aliases: Required: False @@ -58,7 +85,7 @@ Gets or sets the association with Commercial's Billing Account. ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaIdentityPrivateStoreExpanded Aliases: Required: False @@ -88,7 +115,7 @@ Gets or sets collection name. ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaIdentityPrivateStoreExpanded Aliases: Required: False @@ -118,7 +145,7 @@ Indicating whether the collection is enabled or disabled. ```yaml Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaIdentityPrivateStoreExpanded Aliases: Required: False @@ -128,12 +155,58 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -JsonFilePath +Path of Json file supplied to the Create operation + +```yaml +Type: System.String +Parameter Sets: CreateViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Create operation + +```yaml +Type: System.String +Parameter Sets: CreateViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Payload +The Collection data structure. +To construct, see NOTES section for PAYLOAD properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection +Parameter Sets: CreateViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -PrivateStoreId The store ID - must use the tenant ID ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaJsonString, CreateViaJsonFilePath Aliases: Required: True @@ -143,6 +216,37 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: CreateViaIdentityPrivateStoreExpanded, CreateViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -SubscriptionsList Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. @@ -150,7 +254,7 @@ On insert, null is considered as bad request ```yaml Type: System.String[] -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaIdentityPrivateStoreExpanded Aliases: Required: False @@ -205,4 +309,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ALIASES ## RELATED LINKS - diff --git a/src/Marketplace/Marketplace/help/New-AzMarketplacePrivateStoreCollectionOffer.md b/src/Marketplace/Marketplace/help/New-AzMarketplacePrivateStoreCollectionOffer.md index 421fe7e824c0..77f846f78c7e 100644 --- a/src/Marketplace/Marketplace/help/New-AzMarketplacePrivateStoreCollectionOffer.md +++ b/src/Marketplace/Marketplace/help/New-AzMarketplacePrivateStoreCollectionOffer.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Marketplace-help.xml Module Name: Az.Marketplace online version: https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollectionoffer schema: 2.0.0 @@ -12,10 +12,56 @@ Update or add an offer to a specific collection of the private store. ## SYNTAX +### CreateExpanded (Default) ``` -New-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId -PrivateStoreId +New-AzMarketplacePrivateStoreCollectionOffer -OfferId -CollectionId -PrivateStoreId [-ETag ] [-IconFileUri ] [-Plan ] [-SpecificPlanIdLimitation ] - [-UpdateSuppressedDueIdempotence] [-DefaultProfile ] [-Confirm] [-WhatIf] [] + [-UpdateSuppressedDueIdempotence] [-DefaultProfile ] [-ProgressAction ] [-WhatIf] + [-Confirm] [] +``` + +### CreateViaJsonString +``` +New-AzMarketplacePrivateStoreCollectionOffer -OfferId -CollectionId -PrivateStoreId + -JsonString [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] + [] +``` + +### CreateViaJsonFilePath +``` +New-AzMarketplacePrivateStoreCollectionOffer -OfferId -CollectionId -PrivateStoreId + -JsonFilePath [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] + [] +``` + +### CreateViaIdentityPrivateStoreExpanded +``` +New-AzMarketplacePrivateStoreCollectionOffer -OfferId -CollectionId + -PrivateStoreInputObject [-ETag ] [-IconFileUri ] [-Plan ] + [-SpecificPlanIdLimitation ] [-UpdateSuppressedDueIdempotence] [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### CreateViaIdentityPrivateStore +``` +New-AzMarketplacePrivateStoreCollectionOffer -OfferId -CollectionId + -PrivateStoreInputObject -Payload [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### CreateViaIdentityCollectionExpanded +``` +New-AzMarketplacePrivateStoreCollectionOffer -OfferId -CollectionInputObject + [-ETag ] [-IconFileUri ] [-Plan ] [-SpecificPlanIdLimitation ] + [-UpdateSuppressedDueIdempotence] [-DefaultProfile ] [-ProgressAction ] [-WhatIf] + [-Confirm] [] +``` + +### CreateViaIdentityCollection +``` +New-AzMarketplacePrivateStoreCollectionOffer -OfferId -CollectionInputObject + -Payload [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -23,7 +69,7 @@ Update or add an offer to a specific collection of the private store. ## EXAMPLES -### Example 1: Creates or updates offer to private store collection +### Example 1: Creates or updates offer to private store collection ```powershell $acc = @{Accessibility = "azure_managedservices_professional"} New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -OfferId aumatics.azure_managedservices -Plan $acc @@ -44,7 +90,7 @@ The collection ID ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaJsonString, CreateViaJsonFilePath, CreateViaIdentityPrivateStoreExpanded, CreateViaIdentityPrivateStore Aliases: Required: True @@ -54,6 +100,22 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -CollectionInputObject +Identity Parameter +To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: CreateViaIdentityCollectionExpanded, CreateViaIdentityCollection +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -DefaultProfile The credentials, account, tenant, and subscription used for communication with Azure. @@ -74,7 +136,7 @@ Identifier for purposes of race condition ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaIdentityPrivateStoreExpanded, CreateViaIdentityCollectionExpanded Aliases: Required: False @@ -89,7 +151,7 @@ Icon File Uris ```yaml Type: System.Collections.Hashtable -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaIdentityPrivateStoreExpanded, CreateViaIdentityCollectionExpanded Aliases: Required: False @@ -99,6 +161,36 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -JsonFilePath +Path of Json file supplied to the Create operation + +```yaml +Type: System.String +Parameter Sets: CreateViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Create operation + +```yaml +Type: System.String +Parameter Sets: CreateViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -OfferId The offer ID to update or delete @@ -114,13 +206,29 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -Payload +The privateStore offer data structure. +To construct, see NOTES section for PAYLOAD properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer +Parameter Sets: CreateViaIdentityPrivateStore, CreateViaIdentityCollection +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -Plan Offer plans To construct, see NOTES section for PLAN properties and create a hash table. ```yaml -Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan[] -Parameter Sets: (All) +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[] +Parameter Sets: CreateExpanded, CreateViaIdentityPrivateStoreExpanded, CreateViaIdentityCollectionExpanded Aliases: Required: False @@ -135,12 +243,43 @@ The store ID - must use the tenant ID ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaJsonString, CreateViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: CreateViaIdentityPrivateStoreExpanded, CreateViaIdentityPrivateStore Aliases: Required: True Position: Named Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -150,7 +289,7 @@ Plan ids limitation for this offer ```yaml Type: System.String[] -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaIdentityPrivateStoreExpanded, CreateViaIdentityCollectionExpanded Aliases: Required: False @@ -166,7 +305,7 @@ If the allow list is identical to the existed one in db, the offer would not be ```yaml Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaIdentityPrivateStoreExpanded, CreateViaIdentityCollectionExpanded Aliases: Required: False @@ -229,4 +368,3 @@ PLAN : Offer plans - `[Accessibility ]`: Plan accessibility ## RELATED LINKS - diff --git a/src/Marketplace/Marketplace/help/New-AzMarketplacePrivateStoreCollectionOfferMultiContext.md b/src/Marketplace/Marketplace/help/New-AzMarketplacePrivateStoreCollectionOfferMultiContext.md new file mode 100644 index 000000000000..64ad67f8a466 --- /dev/null +++ b/src/Marketplace/Marketplace/help/New-AzMarketplacePrivateStoreCollectionOfferMultiContext.md @@ -0,0 +1,318 @@ +--- +external help file: Az.Marketplace-help.xml +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollectionoffermulticontext +schema: 2.0.0 +--- + +# New-AzMarketplacePrivateStoreCollectionOfferMultiContext + +## SYNOPSIS +Upsert an offer with multiple context details. + +## SYNTAX + +### OfferExpanded (Default) +``` +New-AzMarketplacePrivateStoreCollectionOfferMultiContext -OfferId -CollectionId + -PrivateStoreId [-ETag ] [-PlansContext ] + [-PropertiesOfferId ] [-DefaultProfile ] [-ProgressAction ] [-WhatIf] + [-Confirm] [] +``` + +### OfferViaIdentityPrivateStoreExpanded +``` +New-AzMarketplacePrivateStoreCollectionOfferMultiContext -OfferId -CollectionId + -PrivateStoreInputObject [-ETag ] [-PlansContext ] + [-PropertiesOfferId ] [-DefaultProfile ] [-ProgressAction ] [-WhatIf] + [-Confirm] [] +``` + +### OfferViaIdentityCollectionExpanded +``` +New-AzMarketplacePrivateStoreCollectionOfferMultiContext -OfferId + -CollectionInputObject [-ETag ] [-PlansContext ] + [-PropertiesOfferId ] [-DefaultProfile ] [-ProgressAction ] [-WhatIf] + [-Confirm] [] +``` + +### OfferViaIdentityExpanded +``` +New-AzMarketplacePrivateStoreCollectionOfferMultiContext -OfferId -InputObject + [-ETag ] [-PlansContext ] [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Upsert an offer with multiple context details. + +## EXAMPLES + +### EXAMPLE 1 +``` +$plan1 = @{ + context = "1f58b5dd-313c-42ed-84fc-f1e351bba7fb" + planId = "plan1" +} +``` + +$plan2 = @{ + context = "ab3de7bc-7a6e-4e9f-a34a-f6922df453e4" + planId = "plan2" +} + +$plans = @($plan1,$plan2) + +New-AzMarketplacePrivateStoreCollectionOfferMultiContext -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -OfferId test_pmc2pc1.vm_4plans -PlansContext $plans + +## PARAMETERS + +### -CollectionId +The collection ID + +```yaml +Type: String +Parameter Sets: OfferExpanded, OfferViaIdentityPrivateStoreExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CollectionInputObject +Identity Parameter +To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + +```yaml +Type: IMarketplaceIdentity +Parameter Sets: OfferViaIdentityCollectionExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ETag +The offer's eTag. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: IMarketplaceIdentity +Parameter Sets: OfferViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -OfferId +The offer ID to update or delete + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PlansContext +. +To construct, see NOTES section for PLANSCONTEXT properties and create a hash table. + +```yaml +Type: IContextAndPlansDetails[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: String +Parameter Sets: OfferExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: IMarketplaceIdentity +Parameter Sets: OfferViaIdentityPrivateStoreExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PropertiesOfferId +The offer ID which contains the plans. + +```yaml +Type: String +Parameter Sets: OfferExpanded, OfferViaIdentityPrivateStoreExpanded, OfferViaIdentityCollectionExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +COLLECTIONINPUTOBJECT \: Identity Parameter + \[AdminRequestApprovalId \\]: The admin request approval ID to get create or update + \[CollectionId \\]: The collection ID + \[Id \\]: Resource identity path + \[OfferId \\]: The offer ID to update or delete + \[PrivateStoreId \\]: The store ID - must use the tenant ID + \[RequestApprovalId \\]: The request approval ID to get create or update + +INPUTOBJECT \: Identity Parameter + \[AdminRequestApprovalId \\]: The admin request approval ID to get create or update + \[CollectionId \\]: The collection ID + \[Id \\]: Resource identity path + \[OfferId \\]: The offer ID to update or delete + \[PrivateStoreId \\]: The store ID - must use the tenant ID + \[RequestApprovalId \\]: The request approval ID to get create or update + +PLANSCONTEXT \: . + \[Context \\]: Plan's context, e.g. +subscription ID, tenant ID. + \[PlanId \\>\]: List of plan IDs. + +PRIVATESTOREINPUTOBJECT \: Identity Parameter + \[AdminRequestApprovalId \\]: The admin request approval ID to get create or update + \[CollectionId \\]: The collection ID + \[Id \\]: Resource identity path + \[OfferId \\]: The offer ID to update or delete + \[PrivateStoreId \\]: The store ID - must use the tenant ID + \[RequestApprovalId \\]: The request approval ID to get create or update + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollectionoffermulticontext](https://learn.microsoft.com/powershell/module/az.marketplace/new-azmarketplaceprivatestorecollectionoffermulticontext) + diff --git a/src/Marketplace/Marketplace/help/Remove-AzMarketplacePrivateStoreCollection.md b/src/Marketplace/Marketplace/help/Remove-AzMarketplacePrivateStoreCollection.md index 7bcd749194e3..3d9b357ad928 100644 --- a/src/Marketplace/Marketplace/help/Remove-AzMarketplacePrivateStoreCollection.md +++ b/src/Marketplace/Marketplace/help/Remove-AzMarketplacePrivateStoreCollection.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Marketplace-help.xml Module Name: Az.Marketplace online version: https://learn.microsoft.com/powershell/module/az.marketplace/remove-azmarketplaceprivatestorecollection schema: 2.0.0 @@ -15,13 +15,21 @@ Delete a collection from the given private store. ### Delete (Default) ``` Remove-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreId - [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] + [-DefaultProfile ] [-PassThru] [-ProgressAction ] [-WhatIf] [-Confirm] + [] +``` + +### DeleteViaIdentityPrivateStore +``` +Remove-AzMarketplacePrivateStoreCollection -CollectionId + -PrivateStoreInputObject [-DefaultProfile ] [-PassThru] + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ### DeleteViaIdentity ``` Remove-AzMarketplacePrivateStoreCollection -InputObject [-DefaultProfile ] - [-PassThru] [-Confirm] [-WhatIf] [] + [-PassThru] [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -43,7 +51,7 @@ The collection ID ```yaml Type: System.String -Parameter Sets: Delete +Parameter Sets: Delete, DeleteViaIdentityPrivateStore Aliases: Required: True @@ -114,6 +122,37 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: DeleteViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Confirm Prompts you for confirmation before running the cmdlet. @@ -174,4 +213,3 @@ INPUTOBJECT ``: Identity Parameter - `[RequestApprovalId ]`: The request approval ID to get create or update ## RELATED LINKS - diff --git a/src/Marketplace/Marketplace/help/Remove-AzMarketplacePrivateStoreCollectionOffer.md b/src/Marketplace/Marketplace/help/Remove-AzMarketplacePrivateStoreCollectionOffer.md index c5a163cfb123..13c4f63d4ce3 100644 --- a/src/Marketplace/Marketplace/help/Remove-AzMarketplacePrivateStoreCollectionOffer.md +++ b/src/Marketplace/Marketplace/help/Remove-AzMarketplacePrivateStoreCollectionOffer.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Marketplace-help.xml Module Name: Az.Marketplace online version: https://learn.microsoft.com/powershell/module/az.marketplace/remove-azmarketplaceprivatestorecollectionoffer schema: 2.0.0 @@ -15,13 +15,29 @@ Deletes an offer from the given collection of private store. ### Delete (Default) ``` Remove-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId - -PrivateStoreId [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] + -PrivateStoreId [-DefaultProfile ] [-PassThru] [-ProgressAction ] + [-WhatIf] [-Confirm] [] +``` + +### DeleteViaIdentityPrivateStore +``` +Remove-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId + -PrivateStoreInputObject [-DefaultProfile ] [-PassThru] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### DeleteViaIdentityCollection +``` +Remove-AzMarketplacePrivateStoreCollectionOffer -OfferId -CollectionInputObject + [-DefaultProfile ] [-PassThru] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` ### DeleteViaIdentity ``` Remove-AzMarketplacePrivateStoreCollectionOffer -InputObject - [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] + [-DefaultProfile ] [-PassThru] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -43,7 +59,7 @@ The collection ID ```yaml Type: System.String -Parameter Sets: Delete +Parameter Sets: Delete, DeleteViaIdentityPrivateStore Aliases: Required: True @@ -53,6 +69,22 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -CollectionInputObject +Identity Parameter +To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: DeleteViaIdentityCollection +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -DefaultProfile The credentials, account, tenant, and subscription used for communication with Azure. @@ -89,7 +121,7 @@ The offer ID to update or delete ```yaml Type: System.String -Parameter Sets: Delete +Parameter Sets: Delete, DeleteViaIdentityPrivateStore, DeleteViaIdentityCollection Aliases: Required: True @@ -129,6 +161,37 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +Parameter Sets: DeleteViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Confirm Prompts you for confirmation before running the cmdlet. @@ -189,4 +252,3 @@ INPUTOBJECT ``: Identity Parameter - `[RequestApprovalId ]`: The request approval ID to get create or update ## RELATED LINKS - diff --git a/src/Marketplace/Marketplace/help/Remove-AzMarketplacePrivateStoreOffer.md b/src/Marketplace/Marketplace/help/Remove-AzMarketplacePrivateStoreOffer.md index 092a118b0e88..7b4bf8e8d795 100644 --- a/src/Marketplace/Marketplace/help/Remove-AzMarketplacePrivateStoreOffer.md +++ b/src/Marketplace/Marketplace/help/Remove-AzMarketplacePrivateStoreOffer.md @@ -1,7 +1,7 @@ --- external help file: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.dll-Help.xml Module Name: Az.Marketplace -online version:https://learn.microsoft.com/powershell/module/az.marketplace/remove-azmarketplaceprivatestoreoffer +online version: https://learn.microsoft.com/powershell/module/az.marketplace/remove-azmarketplaceprivatestoreoffer schema: 2.0.0 --- @@ -14,7 +14,8 @@ Remove an offer from private store. ``` Remove-AzMarketplacePrivateStoreOffer -PrivateStoreId -OfferId [-PassThru] - [-DefaultProfile ] [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -91,6 +92,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Confirm Prompts you for confirmation before running the cmdlet. diff --git a/src/Marketplace/Marketplace/help/Set-AzMarketplaceBulkPrivateStoreCollectionAction.md b/src/Marketplace/Marketplace/help/Set-AzMarketplaceBulkPrivateStoreCollectionAction.md index b08fb4dcca08..baa73ac2980f 100644 --- a/src/Marketplace/Marketplace/help/Set-AzMarketplaceBulkPrivateStoreCollectionAction.md +++ b/src/Marketplace/Marketplace/help/Set-AzMarketplaceBulkPrivateStoreCollectionAction.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Marketplace-help.xml Module Name: Az.Marketplace online version: https://learn.microsoft.com/powershell/module/az.marketplace/set-azmarketplacebulkprivatestorecollectionaction schema: 2.0.0 @@ -15,13 +15,26 @@ Perform an action on bulk collections ### BulkExpanded (Default) ``` Set-AzMarketplaceBulkPrivateStoreCollectionAction -PrivateStoreId [-Action ] - [-CollectionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] + [-CollectionId ] [-DefaultProfile ] [-ProgressAction ] [-WhatIf] + [-Confirm] [] ``` ### Bulk ``` Set-AzMarketplaceBulkPrivateStoreCollectionAction -PrivateStoreId -Payload - [-DefaultProfile ] [-Confirm] [-WhatIf] [] + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### BulkViaJsonFilePath +``` +Set-AzMarketplaceBulkPrivateStoreCollectionAction -PrivateStoreId -JsonFilePath + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### BulkViaJsonString +``` +Set-AzMarketplaceBulkPrivateStoreCollectionAction -PrivateStoreId -JsonString + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -29,7 +42,7 @@ Perform an action on bulk collections ## EXAMPLES -### Example 1: Preforms bulk action on collections +### Example 1: Preforms bulk action on collections ```powershell Set-AzMarketplaceBulkPrivateStoreCollectionAction -PrivateStoreId 3ac32d8c-e888-4dc6-b4ff-be4d755af13a -Payload @{Action = "EnableCollections"; CollectionId = "3ac32d8c-e888-4dc6-b4ff-be4d755af13a", "fdb889a1-cf3e-49f0-95b8-2bb012fa01f1" } ``` @@ -89,12 +102,42 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -JsonFilePath +Path of Json file supplied to the Bulk operation + +```yaml +Type: System.String +Parameter Sets: BulkViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Bulk operation + +```yaml +Type: System.String +Parameter Sets: BulkViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Payload Bulk collections action properties To construct, see NOTES section for PAYLOAD properties and create a hash table. ```yaml -Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IBulkCollectionsPayload +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IBulkCollectionsPayload Parameter Sets: Bulk Aliases: @@ -120,6 +163,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Confirm Prompts you for confirmation before running the cmdlet. @@ -176,4 +234,3 @@ PAYLOAD ``: Bulk collections action properties - `[CollectionId ]`: collection ids list that the action is performed on ## RELATED LINKS - diff --git a/src/Marketplace/Marketplace/help/Set-AzMarketplacePrivateStore.md b/src/Marketplace/Marketplace/help/Set-AzMarketplacePrivateStore.md index cb885cdccc93..8768f54b6d7c 100644 --- a/src/Marketplace/Marketplace/help/Set-AzMarketplacePrivateStore.md +++ b/src/Marketplace/Marketplace/help/Set-AzMarketplacePrivateStore.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Marketplace-help.xml Module Name: Az.Marketplace online version: https://learn.microsoft.com/powershell/module/az.marketplace/set-azmarketplaceprivatestore schema: 2.0.0 @@ -12,11 +12,24 @@ Changes private store properties ## SYNTAX +### UpdateExpanded (Default) ``` -Set-AzMarketplacePrivateStore -Id [-Availability ] [-Branding ] - [-ETag ] [-IsGov] [-NotificationSettingRecipient ] - [-NotificationSettingSendToAllMarketplaceAdmin] [-PrivateStoreName ] [-TenantId ] - [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +Set-AzMarketplacePrivateStore -Id [-Availability ] [-Branding ] [-ETag ] + [-IsGov] [-NotificationSettingRecipient ] [-NotificationSettingSendToAllMarketplaceAdmin] + [-PrivateStoreName ] [-TenantId ] [-DefaultProfile ] [-PassThru] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### UpdateViaJsonFilePath +``` +Set-AzMarketplacePrivateStore -Id -JsonFilePath [-DefaultProfile ] [-PassThru] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### UpdateViaJsonString +``` +Set-AzMarketplacePrivateStore -Id -JsonString [-DefaultProfile ] [-PassThru] + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -37,8 +50,8 @@ This command changes private store properties Indicates private store availability ```yaml -Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Support.Availability -Parameter Sets: (All) +Type: System.String +Parameter Sets: UpdateExpanded Aliases: Required: False @@ -53,7 +66,7 @@ Gets or sets list of branding characteristics ```yaml Type: System.Collections.Hashtable -Parameter Sets: (All) +Parameter Sets: UpdateExpanded Aliases: Required: False @@ -83,7 +96,7 @@ Identifier for purposes of race condition ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: UpdateExpanded Aliases: Required: False @@ -113,7 +126,7 @@ Is government ```yaml Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) +Parameter Sets: UpdateExpanded Aliases: Required: False @@ -123,13 +136,43 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -JsonFilePath +Path of Json file supplied to the Update operation + +```yaml +Type: System.String +Parameter Sets: UpdateViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Update operation + +```yaml +Type: System.String +Parameter Sets: UpdateViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -NotificationSettingRecipient Gets or sets list of notified recipients for new requests To construct, see NOTES section for NOTIFICATIONSETTINGRECIPIENT properties and create a hash table. ```yaml -Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IRecipient[] -Parameter Sets: (All) +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IRecipient[] +Parameter Sets: UpdateExpanded Aliases: Required: False @@ -144,7 +187,7 @@ Gets or sets whether to send email to all marketplace admins for new requests ```yaml Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) +Parameter Sets: UpdateExpanded Aliases: Required: False @@ -174,7 +217,7 @@ Private Store Name ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: UpdateExpanded Aliases: Required: False @@ -184,12 +227,27 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -TenantId Tenant id ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: UpdateExpanded Aliases: Required: False @@ -252,4 +310,3 @@ NOTIFICATIONSETTINGRECIPIENT : Gets or sets list of notified recip - `[PrincipalId ]`: Principal ID ## RELATED LINKS - diff --git a/src/Marketplace/Marketplace/help/Set-AzMarketplacePrivateStoreCollection.md b/src/Marketplace/Marketplace/help/Set-AzMarketplacePrivateStoreCollection.md index dbcfc20a39d5..f2f97f2bcc99 100644 --- a/src/Marketplace/Marketplace/help/Set-AzMarketplacePrivateStoreCollection.md +++ b/src/Marketplace/Marketplace/help/Set-AzMarketplacePrivateStoreCollection.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Marketplace-help.xml Module Name: Az.Marketplace online version: https://learn.microsoft.com/powershell/module/az.marketplace/set-azmarketplaceprivatestorecollection schema: 2.0.0 @@ -12,10 +12,23 @@ Create or update private store collection ## SYNTAX +### UpdateExpanded (Default) ``` Set-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreId [-AllSubscription] [-Claim ] [-CollectionName ] [-Enabled] [-SubscriptionsList ] - [-DefaultProfile ] [-Confirm] [-WhatIf] [] + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### UpdateViaJsonFilePath +``` +Set-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreId -JsonFilePath + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### UpdateViaJsonString +``` +Set-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreId -JsonString + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -43,7 +56,7 @@ Indicating whether all subscriptions are selected (=true) or not (=false). ```yaml Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) +Parameter Sets: UpdateExpanded Aliases: Required: False @@ -58,7 +71,7 @@ Gets or sets the association with Commercial's Billing Account. ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: UpdateExpanded Aliases: Required: False @@ -88,7 +101,7 @@ Gets or sets collection name. ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: UpdateExpanded Aliases: Required: False @@ -118,7 +131,7 @@ Indicating whether the collection is enabled or disabled. ```yaml Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) +Parameter Sets: UpdateExpanded Aliases: Required: False @@ -128,6 +141,36 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -JsonFilePath +Path of Json file supplied to the Update operation + +```yaml +Type: System.String +Parameter Sets: UpdateViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Update operation + +```yaml +Type: System.String +Parameter Sets: UpdateViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -PrivateStoreId The store ID - must use the tenant ID @@ -143,6 +186,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -SubscriptionsList Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. @@ -150,7 +208,7 @@ On insert, null is considered as bad request ```yaml Type: System.String[] -Parameter Sets: (All) +Parameter Sets: UpdateExpanded Aliases: Required: False @@ -205,4 +263,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ALIASES ## RELATED LINKS - diff --git a/src/Marketplace/Marketplace/help/Set-AzMarketplacePrivateStoreCollectionOffer.md b/src/Marketplace/Marketplace/help/Set-AzMarketplacePrivateStoreCollectionOffer.md index 93b335586afe..00cac207d09a 100644 --- a/src/Marketplace/Marketplace/help/Set-AzMarketplacePrivateStoreCollectionOffer.md +++ b/src/Marketplace/Marketplace/help/Set-AzMarketplacePrivateStoreCollectionOffer.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Marketplace-help.xml Module Name: Az.Marketplace online version: https://learn.microsoft.com/powershell/module/az.marketplace/set-azmarketplaceprivatestorecollectionoffer schema: 2.0.0 @@ -12,10 +12,26 @@ Update or add an offer to a specific collection of the private store. ## SYNTAX +### UpdateExpanded (Default) ``` Set-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId -PrivateStoreId [-ETag ] [-IconFileUri ] [-Plan ] [-SpecificPlanIdLimitation ] - [-UpdateSuppressedDueIdempotence] [-DefaultProfile ] [-Confirm] [-WhatIf] [] + [-UpdateSuppressedDueIdempotence] [-DefaultProfile ] [-ProgressAction ] [-WhatIf] + [-Confirm] [] +``` + +### UpdateViaJsonFilePath +``` +Set-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId -PrivateStoreId + -JsonFilePath [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] + [] +``` + +### UpdateViaJsonString +``` +Set-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId -PrivateStoreId + -JsonString [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -23,7 +39,7 @@ Update or add an offer to a specific collection of the private store. ## EXAMPLES -### Example 1: Creates or updates offer to private store collection +### Example 1: Creates or updates offer to private store collection ```powershell $acc = @{Accessibility = "azure_managedservices_professional"} New-AzMarketplacePrivateStoreCollectionOffer -CollectionId fdb889a1-cf3e-49f0-95b8-2bb012fa01f1 -PrivateStoreId 7f5402e4-e8f4-46bd-9bd1-8d27866a606b -OfferId aumatics.azure_managedservices -Plan $acc @@ -74,7 +90,7 @@ Identifier for purposes of race condition ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: UpdateExpanded Aliases: Required: False @@ -89,7 +105,7 @@ Icon File Uris ```yaml Type: System.Collections.Hashtable -Parameter Sets: (All) +Parameter Sets: UpdateExpanded Aliases: Required: False @@ -99,6 +115,36 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -JsonFilePath +Path of Json file supplied to the Update operation + +```yaml +Type: System.String +Parameter Sets: UpdateViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Update operation + +```yaml +Type: System.String +Parameter Sets: UpdateViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -OfferId The offer ID to update or delete @@ -119,8 +165,8 @@ Offer plans To construct, see NOTES section for PLAN properties and create a hash table. ```yaml -Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.Api20210601.IPlan[] -Parameter Sets: (All) +Type: Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IPlan[] +Parameter Sets: UpdateExpanded Aliases: Required: False @@ -145,12 +191,27 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -SpecificPlanIdLimitation Plan ids limitation for this offer ```yaml Type: System.String[] -Parameter Sets: (All) +Parameter Sets: UpdateExpanded Aliases: Required: False @@ -166,7 +227,7 @@ If the allow list is identical to the existed one in db, the offer would not be ```yaml Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) +Parameter Sets: UpdateExpanded Aliases: Required: False @@ -229,4 +290,3 @@ PLAN : Offer plans - `[Accessibility ]`: Plan accessibility ## RELATED LINKS - diff --git a/src/Marketplace/Marketplace/help/Set-AzMarketplacePrivateStoreOffer.md b/src/Marketplace/Marketplace/help/Set-AzMarketplacePrivateStoreOffer.md index 6d36d16d4fc3..822711b1cb54 100644 --- a/src/Marketplace/Marketplace/help/Set-AzMarketplacePrivateStoreOffer.md +++ b/src/Marketplace/Marketplace/help/Set-AzMarketplacePrivateStoreOffer.md @@ -15,7 +15,8 @@ Updates or creates offer for private store. ``` Set-AzMarketplacePrivateStoreOffer -PrivateStoreId -OfferId -SpecificPlanIdsLimitation [-ETag ] - [-DefaultProfile ] [-WhatIf] [-Confirm] [] + [-SubscriptionId ] [-DefaultProfile ] [-ProgressAction ] + [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -111,7 +112,6 @@ Type : Microsoft.Marketplace/privateStores/offers Updates offer for private store with private plans only that was created under subscription scope. Etag is needed. - ## PARAMETERS ### -DefaultProfile @@ -174,6 +174,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -SpecificPlanIdsLimitation Required Azure Marketplace privateStore offer's specific plan ids limitation @@ -189,6 +204,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -SubscriptionId +Azure subscription id + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Confirm Prompts you for confirmation before running the cmdlet. diff --git a/src/Marketplace/Marketplace/help/Test-AzMarketplacePrivateStoreAnyExistingOffer.md b/src/Marketplace/Marketplace/help/Test-AzMarketplacePrivateStoreAnyExistingOffer.md new file mode 100644 index 000000000000..4fce5dafdeb8 --- /dev/null +++ b/src/Marketplace/Marketplace/help/Test-AzMarketplacePrivateStoreAnyExistingOffer.md @@ -0,0 +1,158 @@ +--- +external help file: Az.Marketplace-help.xml +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/test-azmarketplaceprivatestoreanyexistingoffer +schema: 2.0.0 +--- + +# Test-AzMarketplacePrivateStoreAnyExistingOffer + +## SYNOPSIS +Query whether exists any offer in the collections. + +## SYNTAX + +### Any (Default) +``` +Test-AzMarketplacePrivateStoreAnyExistingOffer -PrivateStoreId [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### AnyViaIdentity +``` +Test-AzMarketplacePrivateStoreAnyExistingOffer -InputObject [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Query whether exists any offer in the collections. + +## EXAMPLES + +### EXAMPLE 1 +``` +Test-AzMarketplacePrivateStoreAnyExistingOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 +``` + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: IMarketplaceIdentity +Parameter Sets: AnyViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: String +Parameter Sets: Any +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IAnyExistingOffersInTheCollectionsResponse +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[AdminRequestApprovalId \\]: The admin request approval ID to get create or update + \[CollectionId \\]: The collection ID + \[Id \\]: Resource identity path + \[OfferId \\]: The offer ID to update or delete + \[PrivateStoreId \\]: The store ID - must use the tenant ID + \[RequestApprovalId \\]: The request approval ID to get create or update + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.marketplace/test-azmarketplaceprivatestoreanyexistingoffer](https://learn.microsoft.com/powershell/module/az.marketplace/test-azmarketplaceprivatestoreanyexistingoffer) + diff --git a/src/Marketplace/Marketplace/help/Update-AzMarketplacePrivateStoreCollection.md b/src/Marketplace/Marketplace/help/Update-AzMarketplacePrivateStoreCollection.md new file mode 100644 index 000000000000..a629abbcf2bb --- /dev/null +++ b/src/Marketplace/Marketplace/help/Update-AzMarketplacePrivateStoreCollection.md @@ -0,0 +1,317 @@ +--- +external help file: Az.Marketplace-help.xml +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/update-azmarketplaceprivatestorecollection +schema: 2.0.0 +--- + +# Update-AzMarketplacePrivateStoreCollection + +## SYNOPSIS +Create private store collection + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzMarketplacePrivateStoreCollection -CollectionId -PrivateStoreId [-AllSubscription] + [-Claim ] [-CollectionName ] [-Enabled] [-SubscriptionsList ] + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### UpdateViaIdentityPrivateStoreExpanded +``` +Update-AzMarketplacePrivateStoreCollection -CollectionId + -PrivateStoreInputObject [-AllSubscription] [-Claim ] + [-CollectionName ] [-Enabled] [-SubscriptionsList ] [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### UpdateViaIdentityPrivateStore +``` +Update-AzMarketplacePrivateStoreCollection -CollectionId + -PrivateStoreInputObject -Payload [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzMarketplacePrivateStoreCollection -InputObject [-AllSubscription] + [-Claim ] [-CollectionName ] [-Enabled] [-SubscriptionsList ] + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Create private store collection + +## EXAMPLES + +### EXAMPLE 1 +``` +Update-AzMarketplacePrivateStoreCollection -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId 8c7a91db-cd41-43b6-af47-2e869654126d -Enabled +``` + +## PARAMETERS + +### -AllSubscription +Indicating whether all subscriptions are selected (=true) or not (=false). + +```yaml +Type: SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityPrivateStoreExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Claim +Gets or sets the association with Commercial's Billing Account. + +```yaml +Type: String +Parameter Sets: UpdateExpanded, UpdateViaIdentityPrivateStoreExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CollectionId +The collection ID + +```yaml +Type: String +Parameter Sets: UpdateExpanded, UpdateViaIdentityPrivateStoreExpanded, UpdateViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CollectionName +Gets or sets collection name. + +```yaml +Type: String +Parameter Sets: UpdateExpanded, UpdateViaIdentityPrivateStoreExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Enabled +Indicating whether the collection is enabled or disabled. + +```yaml +Type: SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityPrivateStoreExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: IMarketplaceIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Payload +The Collection data structure. +To construct, see NOTES section for PAYLOAD properties and create a hash table. + +```yaml +Type: ICollection +Parameter Sets: UpdateViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: IMarketplaceIdentity +Parameter Sets: UpdateViaIdentityPrivateStoreExpanded, UpdateViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionsList +Gets or sets subscription ids list. +Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. +On insert, null is considered as bad request + +```yaml +Type: String[] +Parameter Sets: UpdateExpanded, UpdateViaIdentityPrivateStoreExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.ICollection +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT \: Identity Parameter + \[AdminRequestApprovalId \\]: The admin request approval ID to get create or update + \[CollectionId \\]: The collection ID + \[Id \\]: Resource identity path + \[OfferId \\]: The offer ID to update or delete + \[PrivateStoreId \\]: The store ID - must use the tenant ID + \[RequestApprovalId \\]: The request approval ID to get create or update + +PAYLOAD \: The Collection data structure. + \[AllSubscription \\]: Indicating whether all subscriptions are selected (=true) or not (=false). + \[Claim \\]: Gets or sets the association with Commercial's Billing Account. + \[CollectionName \\]: Gets or sets collection name. + \[Enabled \\]: Indicating whether the collection is enabled or disabled. + \[SubscriptionsList \\>\]: Gets or sets subscription ids list. +Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. +On insert, null is considered as bad request + +PRIVATESTOREINPUTOBJECT \: Identity Parameter + \[AdminRequestApprovalId \\]: The admin request approval ID to get create or update + \[CollectionId \\]: The collection ID + \[Id \\]: Resource identity path + \[OfferId \\]: The offer ID to update or delete + \[PrivateStoreId \\]: The store ID - must use the tenant ID + \[RequestApprovalId \\]: The request approval ID to get create or update + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.marketplace/update-azmarketplaceprivatestorecollection](https://learn.microsoft.com/powershell/module/az.marketplace/update-azmarketplaceprivatestorecollection) + diff --git a/src/Marketplace/Marketplace/help/Update-AzMarketplacePrivateStoreCollectionOffer.md b/src/Marketplace/Marketplace/help/Update-AzMarketplacePrivateStoreCollectionOffer.md new file mode 100644 index 000000000000..e62419cbb0b5 --- /dev/null +++ b/src/Marketplace/Marketplace/help/Update-AzMarketplacePrivateStoreCollectionOffer.md @@ -0,0 +1,377 @@ +--- +external help file: Az.Marketplace-help.xml +Module Name: Az.Marketplace +online version: https://learn.microsoft.com/powershell/module/az.marketplace/update-azmarketplaceprivatestorecollectionoffer +schema: 2.0.0 +--- + +# Update-AzMarketplacePrivateStoreCollectionOffer + +## SYNOPSIS +Update or add an offer to a specific collection of the private store. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId + -PrivateStoreId [-ETag ] [-IconFileUri ] [-Plan ] + [-SpecificPlanIdLimitation ] [-UpdateSuppressedDueIdempotence] [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### UpdateViaIdentityPrivateStoreExpanded +``` +Update-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId + -PrivateStoreInputObject [-ETag ] [-IconFileUri ] [-Plan ] + [-SpecificPlanIdLimitation ] [-UpdateSuppressedDueIdempotence] [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### UpdateViaIdentityPrivateStore +``` +Update-AzMarketplacePrivateStoreCollectionOffer -CollectionId -OfferId + -PrivateStoreInputObject -Payload [-DefaultProfile ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +### UpdateViaIdentityCollectionExpanded +``` +Update-AzMarketplacePrivateStoreCollectionOffer -OfferId -CollectionInputObject + [-ETag ] [-IconFileUri ] [-Plan ] [-SpecificPlanIdLimitation ] + [-UpdateSuppressedDueIdempotence] [-DefaultProfile ] [-ProgressAction ] [-WhatIf] + [-Confirm] [] +``` + +### UpdateViaIdentityCollection +``` +Update-AzMarketplacePrivateStoreCollectionOffer -OfferId -CollectionInputObject + -Payload [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] + [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzMarketplacePrivateStoreCollectionOffer -InputObject [-ETag ] + [-IconFileUri ] [-Plan ] [-SpecificPlanIdLimitation ] + [-UpdateSuppressedDueIdempotence] [-DefaultProfile ] [-ProgressAction ] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION +Update or add an offer to a specific collection of the private store. + +## EXAMPLES + +### EXAMPLE 1 +``` +Update-AzMarketplacePrivateStoreCollectionOffer -PrivateStoreId a260d38c-96cf-492d-a340-404d0c4b3ad6 -CollectionId 8c7a91db-cd41-43b6-af47-2e869654126d -OfferId "aumatics.azure_managedservices" -SpecificPlanIdLimitation $null +``` + +## PARAMETERS + +### -CollectionId +The collection ID + +```yaml +Type: String +Parameter Sets: UpdateExpanded, UpdateViaIdentityPrivateStoreExpanded, UpdateViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CollectionInputObject +Identity Parameter +To construct, see NOTES section for COLLECTIONINPUTOBJECT properties and create a hash table. + +```yaml +Type: IMarketplaceIdentity +Parameter Sets: UpdateViaIdentityCollectionExpanded, UpdateViaIdentityCollection +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ETag +Identifier for purposes of race condition + +```yaml +Type: String +Parameter Sets: UpdateExpanded, UpdateViaIdentityPrivateStoreExpanded, UpdateViaIdentityCollectionExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IconFileUri +Icon File Uris + +```yaml +Type: Hashtable +Parameter Sets: UpdateExpanded, UpdateViaIdentityPrivateStoreExpanded, UpdateViaIdentityCollectionExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: IMarketplaceIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -OfferId +The offer ID to update or delete + +```yaml +Type: String +Parameter Sets: UpdateExpanded, UpdateViaIdentityPrivateStoreExpanded, UpdateViaIdentityPrivateStore, UpdateViaIdentityCollectionExpanded, UpdateViaIdentityCollection +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Payload +The privateStore offer data structure. +To construct, see NOTES section for PAYLOAD properties and create a hash table. + +```yaml +Type: IOffer +Parameter Sets: UpdateViaIdentityPrivateStore, UpdateViaIdentityCollection +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Plan +Offer plans +To construct, see NOTES section for PLAN properties and create a hash table. + +```yaml +Type: IPlan[] +Parameter Sets: UpdateExpanded, UpdateViaIdentityPrivateStoreExpanded, UpdateViaIdentityCollectionExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreId +The store ID - must use the tenant ID + +```yaml +Type: String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateStoreInputObject +Identity Parameter +To construct, see NOTES section for PRIVATESTOREINPUTOBJECT properties and create a hash table. + +```yaml +Type: IMarketplaceIdentity +Parameter Sets: UpdateViaIdentityPrivateStoreExpanded, UpdateViaIdentityPrivateStore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SpecificPlanIdLimitation +Plan ids limitation for this offer + +```yaml +Type: String[] +Parameter Sets: UpdateExpanded, UpdateViaIdentityPrivateStoreExpanded, UpdateViaIdentityCollectionExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UpdateSuppressedDueIdempotence +Indicating whether the offer was not updated to db (true = not updated). +If the allow list is identical to the existed one in db, the offer would not be updated. + +```yaml +Type: SwitchParameter +Parameter Sets: UpdateExpanded, UpdateViaIdentityPrivateStoreExpanded, UpdateViaIdentityCollectionExpanded, UpdateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IMarketplaceIdentity +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Marketplace.Models.IOffer +## NOTES +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. +For information on hash tables, run Get-Help about_Hash_Tables. + +COLLECTIONINPUTOBJECT \: Identity Parameter + \[AdminRequestApprovalId \\]: The admin request approval ID to get create or update + \[CollectionId \\]: The collection ID + \[Id \\]: Resource identity path + \[OfferId \\]: The offer ID to update or delete + \[PrivateStoreId \\]: The store ID - must use the tenant ID + \[RequestApprovalId \\]: The request approval ID to get create or update + +INPUTOBJECT \: Identity Parameter + \[AdminRequestApprovalId \\]: The admin request approval ID to get create or update + \[CollectionId \\]: The collection ID + \[Id \\]: Resource identity path + \[OfferId \\]: The offer ID to update or delete + \[PrivateStoreId \\]: The store ID - must use the tenant ID + \[RequestApprovalId \\]: The request approval ID to get create or update + +PAYLOAD \: The privateStore offer data structure. + \[ETag \\]: Identifier for purposes of race condition + \[IconFileUri \\]: Icon File Uris + \[(Any) \\]: This indicates any property can be added to this object. + \[Plan \\>\]: Offer plans + \[Accessibility \\]: Plan accessibility + \[SpecificPlanIdsLimitation \\>\]: Plan ids limitation for this offer + \[UpdateSuppressedDueIdempotence \\]: Indicating whether the offer was not updated to db (true = not updated). +If the allow list is identical to the existed one in db, the offer would not be updated. + +PLAN \: Offer plans + \[Accessibility \\]: Plan accessibility + +PRIVATESTOREINPUTOBJECT \: Identity Parameter + \[AdminRequestApprovalId \\]: The admin request approval ID to get create or update + \[CollectionId \\]: The collection ID + \[Id \\]: Resource identity path + \[OfferId \\]: The offer ID to update or delete + \[PrivateStoreId \\]: The store ID - must use the tenant ID + \[RequestApprovalId \\]: The request approval ID to get create or update + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.marketplace/update-azmarketplaceprivatestorecollectionoffer](https://learn.microsoft.com/powershell/module/az.marketplace/update-azmarketplaceprivatestorecollectionoffer) +